// <auto-generated>
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>

namespace k8s.Models
{
    using Microsoft.Rest;
    using Newtonsoft.Json;
    using System.Linq;

    public partial class V1PortStatus
    {
        /// <summary>
        /// Initializes a new instance of the V1PortStatus class.
        /// </summary>
        public V1PortStatus()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1PortStatus class.
        /// </summary>
        /// <param name="port">Port is the port number of the service port of
        /// which status is recorded here</param>
        /// <param name="protocol">Protocol is the protocol of the service port
        /// of which status is recorded here The supported values are: "TCP",
        /// "UDP", "SCTP"</param>
        /// <param name="error">Error is to record the problem with the service
        /// port The format of the error shall comply with the following rules:
        /// - built-in error values shall be specified in this file and those
        /// shall use
        /// CamelCase names
        /// - cloud provider specific error values must have names that comply
        /// with the
        /// format foo.example.com/CamelCase.</param>
        public V1PortStatus(int port, string protocol, string error = default(string))
        {
            Error = error;
            Port = port;
            Protocol = protocol;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets error is to record the problem with the service port
        /// The format of the error shall comply with the following rules: -
        /// built-in error values shall be specified in this file and those
        /// shall use
        /// CamelCase names
        /// - cloud provider specific error values must have names that comply
        /// with the
        /// format foo.example.com/CamelCase.
        /// </summary>
        [JsonProperty(PropertyName = "error")]
        public string Error { get; set; }

        /// <summary>
        /// Gets or sets port is the port number of the service port of which
        /// status is recorded here
        /// </summary>
        [JsonProperty(PropertyName = "port")]
        public int Port { get; set; }

        /// <summary>
        /// Gets or sets protocol is the protocol of the service port of which
        /// status is recorded here The supported values are: "TCP", "UDP",
        /// "SCTP"
        /// </summary>
        [JsonProperty(PropertyName = "protocol")]
        public string Protocol { get; set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public virtual void Validate()
        {
            if (Protocol == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "Protocol");
            }
        }
    }
}
