/* 
 * 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>
    /// CG1K_INDANAG - AddressTypeCO&lt;br&gt;Proprietà chiave:&lt;ul&gt;&lt;li&gt;&lt;b&gt;Id&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;
    /// </summary>
    [DataContract]
        public partial class AddressTypeCODTO :  IEquatable<AddressTypeCODTO>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AddressTypeCODTO" /> class.
        /// </summary>
        /// <param name="id">CG1K_ID - ID (Required only in PUT/PATCH).</param>
        /// <param name="idCG1J">CG1K_ID_CG1J - Riferimento indirizzo (required).</param>
        /// <param name="tipo">CG1K_TIPO - Tipo indirizzo&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;1&lt;/i&gt; - Sede attività&lt;/li&gt;&lt;li&gt;&lt;i&gt;2&lt;/i&gt; - Residenza&lt;/li&gt;&lt;li&gt;&lt;i&gt;3&lt;/i&gt; - Corrispondenza&lt;/li&gt;&lt;li&gt;&lt;i&gt;4&lt;/i&gt; - Indirizzo legale&lt;/li&gt;&lt;li&gt;&lt;i&gt;5&lt;/i&gt; - Residenza estera&lt;/li&gt;&lt;/ul&gt;.</param>
        /// <param name="additionalData">additionalData.</param>
        /// <param name="pluginData">pluginData.</param>
        public AddressTypeCODTO(long? id = default(long?), long? idCG1J = default(long?), int? tipo = default(int?), Dictionary<string, Object> additionalData = default(Dictionary<string, Object>), Dictionary<string, Object> pluginData = default(Dictionary<string, Object>))
        {
            // to ensure "idCG1J" is required (not null)
            if (idCG1J == null)
            {
                throw new InvalidDataException("idCG1J is a required property for AddressTypeCODTO and cannot be null");
            }
            else
            {
                this.IdCG1J = idCG1J;
            }
            this.Id = id;
            this.Tipo = tipo;
            this.AdditionalData = additionalData;
            this.PluginData = pluginData;
        }
        
        /// <summary>
        /// CG1K_ID - ID (Required only in PUT/PATCH)
        /// </summary>
        /// <value>CG1K_ID - ID (Required only in PUT/PATCH)</value>
        [DataMember(Name="id", EmitDefaultValue=false)]
        public long? Id { get; set; }

        /// <summary>
        /// CG1K_ID_CG1J - Riferimento indirizzo
        /// </summary>
        /// <value>CG1K_ID_CG1J - Riferimento indirizzo</value>
        [DataMember(Name="idCG1J", EmitDefaultValue=false)]
        public long? IdCG1J { get; set; }

        /// <summary>
        /// CG1K_TIPO - Tipo indirizzo&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;1&lt;/i&gt; - Sede attività&lt;/li&gt;&lt;li&gt;&lt;i&gt;2&lt;/i&gt; - Residenza&lt;/li&gt;&lt;li&gt;&lt;i&gt;3&lt;/i&gt; - Corrispondenza&lt;/li&gt;&lt;li&gt;&lt;i&gt;4&lt;/i&gt; - Indirizzo legale&lt;/li&gt;&lt;li&gt;&lt;i&gt;5&lt;/i&gt; - Residenza estera&lt;/li&gt;&lt;/ul&gt;
        /// </summary>
        /// <value>CG1K_TIPO - Tipo indirizzo&lt;br&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;1&lt;/i&gt; - Sede attività&lt;/li&gt;&lt;li&gt;&lt;i&gt;2&lt;/i&gt; - Residenza&lt;/li&gt;&lt;li&gt;&lt;i&gt;3&lt;/i&gt; - Corrispondenza&lt;/li&gt;&lt;li&gt;&lt;i&gt;4&lt;/i&gt; - Indirizzo legale&lt;/li&gt;&lt;li&gt;&lt;i&gt;5&lt;/i&gt; - Residenza estera&lt;/li&gt;&lt;/ul&gt;</value>
        [DataMember(Name="tipo", EmitDefaultValue=false)]
        public int? Tipo { 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 AddressTypeCODTO {\n");
            sb.Append("  Id: ").Append(Id).Append("\n");
            sb.Append("  IdCG1J: ").Append(IdCG1J).Append("\n");
            sb.Append("  Tipo: ").Append(Tipo).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 AddressTypeCODTO);
        }

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

            return 
                (
                    this.Id == input.Id ||
                    (this.Id != null &&
                    this.Id.Equals(input.Id))
                ) && 
                (
                    this.IdCG1J == input.IdCG1J ||
                    (this.IdCG1J != null &&
                    this.IdCG1J.Equals(input.IdCG1J))
                ) && 
                (
                    this.Tipo == input.Tipo ||
                    (this.Tipo != null &&
                    this.Tipo.Equals(input.Tipo))
                ) && 
                (
                    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.Id != null)
                    hashCode = hashCode * 59 + this.Id.GetHashCode();
                if (this.IdCG1J != null)
                    hashCode = hashCode * 59 + this.IdCG1J.GetHashCode();
                if (this.Tipo != null)
                    hashCode = hashCode * 59 + this.Tipo.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;
        }
    }
}
