// <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;

    /// <summary>
    /// Event is a report of an event somewhere in the cluster.
    /// </summary>
    public partial class V1Event
    {
        /// <summary>
        /// Initializes a new instance of the V1Event class.
        /// </summary>
        public V1Event()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1Event class.
        /// </summary>
        /// <param name="involvedObject">The object that this event is
        /// about.</param>
        /// <param name="metadata">Standard object's metadata. More info:
        /// https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata</param>
        /// <param name="action">What action was taken/failed regarding to the
        /// Regarding object.</param>
        /// <param name="apiVersion">APIVersion defines the versioned schema of
        /// this representation of an object. Servers should convert recognized
        /// schemas to the latest internal value, and may reject unrecognized
        /// values. More info:
        /// https://git.k8s.io/community/contributors/devel/api-conventions.md#resources</param>
        /// <param name="count">The number of times this event has
        /// occurred.</param>
        /// <param name="eventTime">Time when this Event was first
        /// observed.</param>
        /// <param name="firstTimestamp">The time at which the event was first
        /// recorded. (Time of server receipt is in TypeMeta.)</param>
        /// <param name="kind">Kind is a string value representing the REST
        /// resource this object represents. Servers may infer this from the
        /// endpoint the client submits requests to. Cannot be updated. In
        /// CamelCase. More info:
        /// https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds</param>
        /// <param name="lastTimestamp">The time at which the most recent
        /// occurrence of this event was recorded.</param>
        /// <param name="message">A human-readable description of the status of
        /// this operation.</param>
        /// <param name="reason">This should be a short, machine understandable
        /// string that gives the reason for the transition into the object's
        /// current status.</param>
        /// <param name="related">Optional secondary object for more complex
        /// actions.</param>
        /// <param name="reportingComponent">Name of the controller that
        /// emitted this Event, e.g. `kubernetes.io/kubelet`.</param>
        /// <param name="reportingInstance">ID of the controller instance, e.g.
        /// `kubelet-xyzf`.</param>
        /// <param name="series">Data about the Event series this event
        /// represents or nil if it's a singleton Event.</param>
        /// <param name="source">The component reporting this event. Should be
        /// a short machine understandable string.</param>
        /// <param name="type">Type of this event (Normal, Warning), new types
        /// could be added in the future</param>
        public V1Event(V1ObjectReference involvedObject, V1ObjectMeta metadata, string action = default(string), string apiVersion = default(string), int? count = default(int?), System.DateTime? eventTime = default(System.DateTime?), System.DateTime? firstTimestamp = default(System.DateTime?), string kind = default(string), System.DateTime? lastTimestamp = default(System.DateTime?), string message = default(string), string reason = default(string), V1ObjectReference related = default(V1ObjectReference), string reportingComponent = default(string), string reportingInstance = default(string), V1EventSeries series = default(V1EventSeries), V1EventSource source = default(V1EventSource), string type = default(string))
        {
            Action = action;
            ApiVersion = apiVersion;
            Count = count;
            EventTime = eventTime;
            FirstTimestamp = firstTimestamp;
            InvolvedObject = involvedObject;
            Kind = kind;
            LastTimestamp = lastTimestamp;
            Message = message;
            Metadata = metadata;
            Reason = reason;
            Related = related;
            ReportingComponent = reportingComponent;
            ReportingInstance = reportingInstance;
            Series = series;
            Source = source;
            Type = type;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets what action was taken/failed regarding to the
        /// Regarding object.
        /// </summary>
        [JsonProperty(PropertyName = "action")]
        public string Action { get; set; }

        /// <summary>
        /// Gets or sets aPIVersion defines the versioned schema of this
        /// representation of an object. Servers should convert recognized
        /// schemas to the latest internal value, and may reject unrecognized
        /// values. More info:
        /// https://git.k8s.io/community/contributors/devel/api-conventions.md#resources
        /// </summary>
        [JsonProperty(PropertyName = "apiVersion")]
        public string ApiVersion { get; set; }

        /// <summary>
        /// Gets or sets the number of times this event has occurred.
        /// </summary>
        [JsonProperty(PropertyName = "count")]
        public int? Count { get; set; }

        /// <summary>
        /// Gets or sets time when this Event was first observed.
        /// </summary>
        [JsonProperty(PropertyName = "eventTime")]
        public System.DateTime? EventTime { get; set; }

        /// <summary>
        /// Gets or sets the time at which the event was first recorded. (Time
        /// of server receipt is in TypeMeta.)
        /// </summary>
        [JsonProperty(PropertyName = "firstTimestamp")]
        public System.DateTime? FirstTimestamp { get; set; }

        /// <summary>
        /// Gets or sets the object that this event is about.
        /// </summary>
        [JsonProperty(PropertyName = "involvedObject")]
        public V1ObjectReference InvolvedObject { get; set; }

        /// <summary>
        /// Gets or sets kind is a string value representing the REST resource
        /// this object represents. Servers may infer this from the endpoint
        /// the client submits requests to. Cannot be updated. In CamelCase.
        /// More info:
        /// https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
        /// </summary>
        [JsonProperty(PropertyName = "kind")]
        public string Kind { get; set; }

        /// <summary>
        /// Gets or sets the time at which the most recent occurrence of this
        /// event was recorded.
        /// </summary>
        [JsonProperty(PropertyName = "lastTimestamp")]
        public System.DateTime? LastTimestamp { get; set; }

        /// <summary>
        /// Gets or sets a human-readable description of the status of this
        /// operation.
        /// </summary>
        [JsonProperty(PropertyName = "message")]
        public string Message { get; set; }

        /// <summary>
        /// Gets or sets standard object's metadata. More info:
        /// https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
        /// </summary>
        [JsonProperty(PropertyName = "metadata")]
        public V1ObjectMeta Metadata { get; set; }

        /// <summary>
        /// Gets or sets this should be a short, machine understandable string
        /// that gives the reason for the transition into the object's current
        /// status.
        /// </summary>
        [JsonProperty(PropertyName = "reason")]
        public string Reason { get; set; }

        /// <summary>
        /// Gets or sets optional secondary object for more complex actions.
        /// </summary>
        [JsonProperty(PropertyName = "related")]
        public V1ObjectReference Related { get; set; }

        /// <summary>
        /// Gets or sets name of the controller that emitted this Event, e.g.
        /// `kubernetes.io/kubelet`.
        /// </summary>
        [JsonProperty(PropertyName = "reportingComponent")]
        public string ReportingComponent { get; set; }

        /// <summary>
        /// Gets or sets ID of the controller instance, e.g. `kubelet-xyzf`.
        /// </summary>
        [JsonProperty(PropertyName = "reportingInstance")]
        public string ReportingInstance { get; set; }

        /// <summary>
        /// Gets or sets data about the Event series this event represents or
        /// nil if it's a singleton Event.
        /// </summary>
        [JsonProperty(PropertyName = "series")]
        public V1EventSeries Series { get; set; }

        /// <summary>
        /// Gets or sets the component reporting this event. Should be a short
        /// machine understandable string.
        /// </summary>
        [JsonProperty(PropertyName = "source")]
        public V1EventSource Source { get; set; }

        /// <summary>
        /// Gets or sets type of this event (Normal, Warning), new types could
        /// be added in the future
        /// </summary>
        [JsonProperty(PropertyName = "type")]
        public string Type { get; set; }

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