namespace Microsoft.Azure.Management.Compute.Models
{
    using Microsoft.Rest;
    using Microsoft.Rest.Serialization;
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// Specifies information about the availability set that the virtual
    /// machine should be assigned to. Virtual machines specified in the same
    /// availability set are allocated to different nodes to maximize
    /// availability. For more information about availability sets, see [Manage
    /// the availability of virtual
    /// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
    /// &lt;br&gt;&lt;br&gt; For more information on Azure planned maintenance,
    /// see [Planned maintenance for virtual machines in
    /// Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json)
    /// &lt;br&gt;&lt;br&gt; Currently, a VM can only be added to availability
    /// set at creation time. An existing VM cannot be added to an availability
    /// set.
    /// </summary>
    [Rest.Serialization.JsonTransformation]
    public partial class AvailabilitySet : Resource
    {
        /// <summary>
        /// Initializes a new instance of the AvailabilitySet class.
        /// </summary>
        public AvailabilitySet()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the AvailabilitySet class.
        /// </summary>
        /// <param name="location">Resource location</param>
        /// <param name="id">Resource Id</param>
        /// <param name="name">Resource name</param>
        /// <param name="type">Resource type</param>
        /// <param name="tags">Resource tags</param>
        /// <param name="platformUpdateDomainCount">Update Domain
        /// count.</param>
        /// <param name="platformFaultDomainCount">Fault Domain count.</param>
        /// <param name="virtualMachines">A list of references to all virtual
        /// machines in the availability set.</param>
        /// <param name="statuses">The resource status information.</param>
        /// <param name="sku">Sku of the availability set, only name is
        /// required to be set. See AvailabilitySetSkuTypes for possible set of
        /// values. Use 'Aligned' for virtual machines with managed disks and
        /// 'Classic' for virtual machines with unmanaged disks. Default value
        /// is 'Classic'.</param>
        public AvailabilitySet(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary<string, string> tags = default(IDictionary<string, string>), int? platformUpdateDomainCount = default(int?), int? platformFaultDomainCount = default(int?), IList<SubResource> virtualMachines = default(IList<SubResource>), IList<InstanceViewStatus> statuses = default(IList<InstanceViewStatus>), Sku sku = default(Sku))
            : base(location, id, name, type, tags)
        {
            PlatformUpdateDomainCount = platformUpdateDomainCount;
            PlatformFaultDomainCount = platformFaultDomainCount;
            VirtualMachines = virtualMachines;
            Statuses = statuses;
            Sku = sku;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets update Domain count.
        /// </summary>
        [JsonProperty(PropertyName = "properties.platformUpdateDomainCount")]
        public int? PlatformUpdateDomainCount { get; set; }

        /// <summary>
        /// Gets or sets fault Domain count.
        /// </summary>
        [JsonProperty(PropertyName = "properties.platformFaultDomainCount")]
        public int? PlatformFaultDomainCount { get; set; }

        /// <summary>
        /// Gets or sets a list of references to all virtual machines in the
        /// availability set.
        /// </summary>
        [JsonProperty(PropertyName = "properties.virtualMachines")]
        public IList<SubResource> VirtualMachines { get; set; }

        /// <summary>
        /// Gets the resource status information.
        /// </summary>
        [JsonProperty(PropertyName = "properties.statuses")]
        public IList<InstanceViewStatus> Statuses { get; private set; }

        /// <summary>
        /// Gets or sets sku of the availability set, only name is required to
        /// be set. See AvailabilitySetSkuTypes for possible set of values. Use
        /// 'Aligned' for virtual machines with managed disks and 'Classic' for
        /// virtual machines with unmanaged disks. Default value is 'Classic'.
        /// </summary>
        [JsonProperty(PropertyName = "sku")]
        public Sku Sku { get; set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public override void Validate()
        {
            base.Validate();
        }
    }
}
