// <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.Collections;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// APIResource specifies the name of a resource and whether it is
    /// namespaced.
    /// </summary>
    public partial class V1APIResource
    {
        /// <summary>
        /// Initializes a new instance of the V1APIResource class.
        /// </summary>
        public V1APIResource()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the V1APIResource class.
        /// </summary>
        /// <param name="kind">kind is the kind for the resource (e.g. 'Foo' is
        /// the kind for a resource 'foo')</param>
        /// <param name="name">name is the plural name of the resource.</param>
        /// <param name="namespaced">namespaced indicates if a resource is
        /// namespaced or not.</param>
        /// <param name="singularName">singularName is the singular name of the
        /// resource.  This allows clients to handle plural and singular
        /// opaquely. The singularName is more correct for reporting status on
        /// a single item and both singular and plural are allowed from the
        /// kubectl CLI interface.</param>
        /// <param name="verbs">verbs is a list of supported kube verbs (this
        /// includes get, list, watch, create, update, patch, delete,
        /// deletecollection, and proxy)</param>
        /// <param name="categories">categories is a list of the grouped
        /// resources this resource belongs to (e.g. 'all')</param>
        /// <param name="group">group is the preferred group of the resource.
        /// Empty implies the group of the containing resource list. For
        /// subresources, this may have a different value, for example:
        /// Scale".</param>
        /// <param name="shortNames">shortNames is a list of suggested short
        /// names of the resource.</param>
        /// <param name="version">version is the preferred version of the
        /// resource.  Empty implies the version of the containing resource
        /// list For subresources, this may have a different value, for
        /// example: v1 (while inside a v1beta1 version of the core resource's
        /// group)".</param>
        public V1APIResource(string kind, string name, bool namespaced, string singularName, IList<string> verbs, IList<string> categories = default(IList<string>), string group = default(string), IList<string> shortNames = default(IList<string>), string version = default(string))
        {
            Categories = categories;
            Group = group;
            Kind = kind;
            Name = name;
            Namespaced = namespaced;
            ShortNames = shortNames;
            SingularName = singularName;
            Verbs = verbs;
            Version = version;
            CustomInit();
        }

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

        /// <summary>
        /// Gets or sets categories is a list of the grouped resources this
        /// resource belongs to (e.g. 'all')
        /// </summary>
        [JsonProperty(PropertyName = "categories")]
        public IList<string> Categories { get; set; }

        /// <summary>
        /// Gets or sets group is the preferred group of the resource.  Empty
        /// implies the group of the containing resource list. For
        /// subresources, this may have a different value, for example: Scale".
        /// </summary>
        [JsonProperty(PropertyName = "group")]
        public string Group { get; set; }

        /// <summary>
        /// Gets or sets kind is the kind for the resource (e.g. 'Foo' is the
        /// kind for a resource 'foo')
        /// </summary>
        [JsonProperty(PropertyName = "kind")]
        public string Kind { get; set; }

        /// <summary>
        /// Gets or sets name is the plural name of the resource.
        /// </summary>
        [JsonProperty(PropertyName = "name")]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets namespaced indicates if a resource is namespaced or
        /// not.
        /// </summary>
        [JsonProperty(PropertyName = "namespaced")]
        public bool Namespaced { get; set; }

        /// <summary>
        /// Gets or sets shortNames is a list of suggested short names of the
        /// resource.
        /// </summary>
        [JsonProperty(PropertyName = "shortNames")]
        public IList<string> ShortNames { get; set; }

        /// <summary>
        /// Gets or sets singularName is the singular name of the resource.
        /// This allows clients to handle plural and singular opaquely. The
        /// singularName is more correct for reporting status on a single item
        /// and both singular and plural are allowed from the kubectl CLI
        /// interface.
        /// </summary>
        [JsonProperty(PropertyName = "singularName")]
        public string SingularName { get; set; }

        /// <summary>
        /// Gets or sets verbs is a list of supported kube verbs (this includes
        /// get, list, watch, create, update, patch, delete, deletecollection,
        /// and proxy)
        /// </summary>
        [JsonProperty(PropertyName = "verbs")]
        public IList<string> Verbs { get; set; }

        /// <summary>
        /// Gets or sets version is the preferred version of the resource.
        /// Empty implies the version of the containing resource list For
        /// subresources, this may have a different value, for example: v1
        /// (while inside a v1beta1 version of the core resource's group)".
        /// </summary>
        [JsonProperty(PropertyName = "version")]
        public string Version { get; set; }

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