/* 
 * TSE Cloud - CO
 *
 * This is Swagger Docs for Document WebApi Teamsystemn Enterprise Cloud, more detail at [https://swagger.io](https://swagger.io).
 *
 * OpenAPI spec version: v2025.3000
 * 
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 */
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;
using SwaggerDateConverter = IO.Swagger.Client.SwaggerDateConverter;
namespace IO.Swagger.Model
{
    /// <summary>
    /// CP01_REGIONE - Regione&lt;br&gt;Proprietà chiave:&lt;ul&gt;&lt;li&gt;&lt;b&gt;IdRegion&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;
    /// </summary>
    [DataContract]
        public partial class RegionCODTO :  IEquatable<RegionCODTO>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="RegionCODTO" /> class.
        /// </summary>
        /// <param name="idRegion">CP01_ID - Cod. Regione (required).</param>
        /// <param name="istatCapitalCityCode">CP01_CODISTATCAPOLUOGO - Codice ISTAT capoluogo (required).</param>
        /// <param name="istatCode">CP01_CODISTAT - Codice ISTAT (required).</param>
        /// <param name="name">CP01_DENOMINAZIONE - Regione (required).</param>
        /// <param name="additionalData">additionalData.</param>
        /// <param name="pluginData">pluginData.</param>
        public RegionCODTO(int? idRegion = default(int?), string istatCapitalCityCode = default(string), string istatCode = default(string), string name = default(string), Dictionary<string, Object> additionalData = default(Dictionary<string, Object>), Dictionary<string, Object> pluginData = default(Dictionary<string, Object>))
        {
            // to ensure "idRegion" is required (not null)
            if (idRegion == null)
            {
                throw new InvalidDataException("idRegion is a required property for RegionCODTO and cannot be null");
            }
            else
            {
                this.IdRegion = idRegion;
            }
            // to ensure "istatCapitalCityCode" is required (not null)
            if (istatCapitalCityCode == null)
            {
                throw new InvalidDataException("istatCapitalCityCode is a required property for RegionCODTO and cannot be null");
            }
            else
            {
                this.IstatCapitalCityCode = istatCapitalCityCode;
            }
            // to ensure "istatCode" is required (not null)
            if (istatCode == null)
            {
                throw new InvalidDataException("istatCode is a required property for RegionCODTO and cannot be null");
            }
            else
            {
                this.IstatCode = istatCode;
            }
            // to ensure "name" is required (not null)
            if (name == null)
            {
                throw new InvalidDataException("name is a required property for RegionCODTO and cannot be null");
            }
            else
            {
                this.Name = name;
            }
            this.AdditionalData = additionalData;
            this.PluginData = pluginData;
        }
        
        /// <summary>
        /// CP01_ID - Cod. Regione
        /// </summary>
        /// <value>CP01_ID - Cod. Regione</value>
        [DataMember(Name="idRegion", EmitDefaultValue=false)]
        public int? IdRegion { get; set; }

        /// <summary>
        /// CP01_CODISTATCAPOLUOGO - Codice ISTAT capoluogo
        /// </summary>
        /// <value>CP01_CODISTATCAPOLUOGO - Codice ISTAT capoluogo</value>
        [DataMember(Name="istatCapitalCityCode", EmitDefaultValue=false)]
        public string IstatCapitalCityCode { get; set; }

        /// <summary>
        /// CP01_CODISTAT - Codice ISTAT
        /// </summary>
        /// <value>CP01_CODISTAT - Codice ISTAT</value>
        [DataMember(Name="istatCode", EmitDefaultValue=false)]
        public string IstatCode { get; set; }

        /// <summary>
        /// CP01_DENOMINAZIONE - Regione
        /// </summary>
        /// <value>CP01_DENOMINAZIONE - Regione</value>
        [DataMember(Name="name", EmitDefaultValue=false)]
        public string Name { get; set; }

        /// <summary>
        /// Gets or Sets AdditionalData
        /// </summary>
        [DataMember(Name="additionalData", EmitDefaultValue=false)]
        public Dictionary<string, Object> AdditionalData { get; set; }

        /// <summary>
        /// Gets or Sets PluginData
        /// </summary>
        [DataMember(Name="pluginData", EmitDefaultValue=false)]
        public Dictionary<string, Object> PluginData { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.Append("class RegionCODTO {\n");
            sb.Append("  IdRegion: ").Append(IdRegion).Append("\n");
            sb.Append("  IstatCapitalCityCode: ").Append(IstatCapitalCityCode).Append("\n");
            sb.Append("  IstatCode: ").Append(IstatCode).Append("\n");
            sb.Append("  Name: ").Append(Name).Append("\n");
            sb.Append("  AdditionalData: ").Append(AdditionalData).Append("\n");
            sb.Append("  PluginData: ").Append(PluginData).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }
  
        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public virtual string ToJson()
        {
            return JsonConvert.SerializeObject(this, Formatting.Indented);
        }

        /// <summary>
        /// Returns true if objects are equal
        /// </summary>
        /// <param name="input">Object to be compared</param>
        /// <returns>Boolean</returns>
        public override bool Equals(object input)
        {
            return this.Equals(input as RegionCODTO);
        }

        /// <summary>
        /// Returns true if RegionCODTO instances are equal
        /// </summary>
        /// <param name="input">Instance of RegionCODTO to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(RegionCODTO input)
        {
            if (input == null)
                return false;

            return 
                (
                    this.IdRegion == input.IdRegion ||
                    (this.IdRegion != null &&
                    this.IdRegion.Equals(input.IdRegion))
                ) && 
                (
                    this.IstatCapitalCityCode == input.IstatCapitalCityCode ||
                    (this.IstatCapitalCityCode != null &&
                    this.IstatCapitalCityCode.Equals(input.IstatCapitalCityCode))
                ) && 
                (
                    this.IstatCode == input.IstatCode ||
                    (this.IstatCode != null &&
                    this.IstatCode.Equals(input.IstatCode))
                ) && 
                (
                    this.Name == input.Name ||
                    (this.Name != null &&
                    this.Name.Equals(input.Name))
                ) && 
                (
                    this.AdditionalData == input.AdditionalData ||
                    this.AdditionalData != null &&
                    input.AdditionalData != null &&
                    this.AdditionalData.SequenceEqual(input.AdditionalData)
                ) && 
                (
                    this.PluginData == input.PluginData ||
                    this.PluginData != null &&
                    input.PluginData != null &&
                    this.PluginData.SequenceEqual(input.PluginData)
                );
        }

        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;
                if (this.IdRegion != null)
                    hashCode = hashCode * 59 + this.IdRegion.GetHashCode();
                if (this.IstatCapitalCityCode != null)
                    hashCode = hashCode * 59 + this.IstatCapitalCityCode.GetHashCode();
                if (this.IstatCode != null)
                    hashCode = hashCode * 59 + this.IstatCode.GetHashCode();
                if (this.Name != null)
                    hashCode = hashCode * 59 + this.Name.GetHashCode();
                if (this.AdditionalData != null)
                    hashCode = hashCode * 59 + this.AdditionalData.GetHashCode();
                if (this.PluginData != null)
                    hashCode = hashCode * 59 + this.PluginData.GetHashCode();
                return hashCode;
            }
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            yield break;
        }
    }
}
