/* 
 * 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>
    /// CO03_LEGCONTATTO - Legame&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 ContactLinksCODTO :  IEquatable<ContactLinksCODTO>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ContactLinksCODTO" /> class.
        /// </summary>
        /// <param name="codiceCg16">CO03_CODICE_CG16 - Codice anagrafica (required).</param>
        /// <param name="flgPref">CO03_FLGPREF - Preferenziale (default to 0).</param>
        /// <param name="id">CO03_ID - ID (Required only in PUT/PATCH).</param>
        /// <param name="idCo02">CO03_ID_CO02 - Codice contatto (required).</param>
        /// <param name="rowversion">CO03_ROWVERSION - RowVersion.</param>
        /// <param name="tipoCo01">CO03_TIPO_CO01 - Tipo Cont./Rif. Azienda (required).</param>
        /// <param name="contactSubject">contactSubject (required).</param>
        /// <param name="contactType">contactType (required).</param>
        /// <param name="generalMasterData">generalMasterData (required).</param>
        /// <param name="additionalData">additionalData.</param>
        /// <param name="pluginData">pluginData.</param>
        public ContactLinksCODTO(int? codiceCg16 = default(int?), double? flgPref = 0, double? id = default(double?), double? idCo02 = default(double?), byte[] rowversion = default(byte[]), string tipoCo01 = default(string), ContactSubjectCODTO contactSubject = default(ContactSubjectCODTO), ContactTypeCODTO contactType = default(ContactTypeCODTO), GeneralMasterDataCODTO generalMasterData = default(GeneralMasterDataCODTO), Dictionary<string, Object> additionalData = default(Dictionary<string, Object>), Dictionary<string, Object> pluginData = default(Dictionary<string, Object>))
        {
            // to ensure "codiceCg16" is required (not null)
            if (codiceCg16 == null)
            {
                throw new InvalidDataException("codiceCg16 is a required property for ContactLinksCODTO and cannot be null");
            }
            else
            {
                this.CodiceCg16 = codiceCg16;
            }
            // to ensure "idCo02" is required (not null)
            if (idCo02 == null)
            {
                throw new InvalidDataException("idCo02 is a required property for ContactLinksCODTO and cannot be null");
            }
            else
            {
                this.IdCo02 = idCo02;
            }
            // to ensure "tipoCo01" is required (not null)
            if (tipoCo01 == null)
            {
                throw new InvalidDataException("tipoCo01 is a required property for ContactLinksCODTO and cannot be null");
            }
            else
            {
                this.TipoCo01 = tipoCo01;
            }
            // to ensure "contactSubject" is required (not null)
            if (contactSubject == null)
            {
                throw new InvalidDataException("contactSubject is a required property for ContactLinksCODTO and cannot be null");
            }
            else
            {
                this.ContactSubject = contactSubject;
            }
            // to ensure "contactType" is required (not null)
            if (contactType == null)
            {
                throw new InvalidDataException("contactType is a required property for ContactLinksCODTO and cannot be null");
            }
            else
            {
                this.ContactType = contactType;
            }
            // to ensure "generalMasterData" is required (not null)
            if (generalMasterData == null)
            {
                throw new InvalidDataException("generalMasterData is a required property for ContactLinksCODTO and cannot be null");
            }
            else
            {
                this.GeneralMasterData = generalMasterData;
            }
            // use default value if no "flgPref" provided
            if (flgPref == null)
            {
                this.FlgPref = 0;
            }
            else
            {
                this.FlgPref = flgPref;
            }
            this.Id = id;
            this.Rowversion = rowversion;
            this.AdditionalData = additionalData;
            this.PluginData = pluginData;
        }
        
        /// <summary>
        /// CO03_CODICE_CG16 - Codice anagrafica
        /// </summary>
        /// <value>CO03_CODICE_CG16 - Codice anagrafica</value>
        [DataMember(Name="codiceCg16", EmitDefaultValue=false)]
        public int? CodiceCg16 { get; set; }

        /// <summary>
        /// CO03_FLGPREF - Preferenziale
        /// </summary>
        /// <value>CO03_FLGPREF - Preferenziale</value>
        [DataMember(Name="flgPref", EmitDefaultValue=false)]
        public double? FlgPref { get; set; }

        /// <summary>
        /// CO03_ID - ID (Required only in PUT/PATCH)
        /// </summary>
        /// <value>CO03_ID - ID (Required only in PUT/PATCH)</value>
        [DataMember(Name="id", EmitDefaultValue=false)]
        public double? Id { get; set; }

        /// <summary>
        /// CO03_ID_CO02 - Codice contatto
        /// </summary>
        /// <value>CO03_ID_CO02 - Codice contatto</value>
        [DataMember(Name="idCo02", EmitDefaultValue=false)]
        public double? IdCo02 { get; set; }

        /// <summary>
        /// CO03_ROWVERSION - RowVersion
        /// </summary>
        /// <value>CO03_ROWVERSION - RowVersion</value>
        [DataMember(Name="rowversion", EmitDefaultValue=false)]
        public byte[] Rowversion { get; set; }

        /// <summary>
        /// CO03_TIPO_CO01 - Tipo Cont./Rif. Azienda
        /// </summary>
        /// <value>CO03_TIPO_CO01 - Tipo Cont./Rif. Azienda</value>
        [DataMember(Name="tipoCo01", EmitDefaultValue=false)]
        public string TipoCo01 { get; set; }

        /// <summary>
        /// Gets or Sets ContactSubject
        /// </summary>
        [DataMember(Name="contactSubject", EmitDefaultValue=false)]
        public ContactSubjectCODTO ContactSubject { get; set; }

        /// <summary>
        /// Gets or Sets ContactType
        /// </summary>
        [DataMember(Name="contactType", EmitDefaultValue=false)]
        public ContactTypeCODTO ContactType { get; set; }

        /// <summary>
        /// Gets or Sets GeneralMasterData
        /// </summary>
        [DataMember(Name="generalMasterData", EmitDefaultValue=false)]
        public GeneralMasterDataCODTO GeneralMasterData { 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 ContactLinksCODTO {\n");
            sb.Append("  CodiceCg16: ").Append(CodiceCg16).Append("\n");
            sb.Append("  FlgPref: ").Append(FlgPref).Append("\n");
            sb.Append("  Id: ").Append(Id).Append("\n");
            sb.Append("  IdCo02: ").Append(IdCo02).Append("\n");
            sb.Append("  Rowversion: ").Append(Rowversion).Append("\n");
            sb.Append("  TipoCo01: ").Append(TipoCo01).Append("\n");
            sb.Append("  ContactSubject: ").Append(ContactSubject).Append("\n");
            sb.Append("  ContactType: ").Append(ContactType).Append("\n");
            sb.Append("  GeneralMasterData: ").Append(GeneralMasterData).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 ContactLinksCODTO);
        }

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

            return 
                (
                    this.CodiceCg16 == input.CodiceCg16 ||
                    (this.CodiceCg16 != null &&
                    this.CodiceCg16.Equals(input.CodiceCg16))
                ) && 
                (
                    this.FlgPref == input.FlgPref ||
                    (this.FlgPref != null &&
                    this.FlgPref.Equals(input.FlgPref))
                ) && 
                (
                    this.Id == input.Id ||
                    (this.Id != null &&
                    this.Id.Equals(input.Id))
                ) && 
                (
                    this.IdCo02 == input.IdCo02 ||
                    (this.IdCo02 != null &&
                    this.IdCo02.Equals(input.IdCo02))
                ) && 
                (
                    this.Rowversion == input.Rowversion ||
                    (this.Rowversion != null &&
                    this.Rowversion.Equals(input.Rowversion))
                ) && 
                (
                    this.TipoCo01 == input.TipoCo01 ||
                    (this.TipoCo01 != null &&
                    this.TipoCo01.Equals(input.TipoCo01))
                ) && 
                (
                    this.ContactSubject == input.ContactSubject ||
                    (this.ContactSubject != null &&
                    this.ContactSubject.Equals(input.ContactSubject))
                ) && 
                (
                    this.ContactType == input.ContactType ||
                    (this.ContactType != null &&
                    this.ContactType.Equals(input.ContactType))
                ) && 
                (
                    this.GeneralMasterData == input.GeneralMasterData ||
                    (this.GeneralMasterData != null &&
                    this.GeneralMasterData.Equals(input.GeneralMasterData))
                ) && 
                (
                    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.CodiceCg16 != null)
                    hashCode = hashCode * 59 + this.CodiceCg16.GetHashCode();
                if (this.FlgPref != null)
                    hashCode = hashCode * 59 + this.FlgPref.GetHashCode();
                if (this.Id != null)
                    hashCode = hashCode * 59 + this.Id.GetHashCode();
                if (this.IdCo02 != null)
                    hashCode = hashCode * 59 + this.IdCo02.GetHashCode();
                if (this.Rowversion != null)
                    hashCode = hashCode * 59 + this.Rowversion.GetHashCode();
                if (this.TipoCo01 != null)
                    hashCode = hashCode * 59 + this.TipoCo01.GetHashCode();
                if (this.ContactSubject != null)
                    hashCode = hashCode * 59 + this.ContactSubject.GetHashCode();
                if (this.ContactType != null)
                    hashCode = hashCode * 59 + this.ContactType.GetHashCode();
                if (this.GeneralMasterData != null)
                    hashCode = hashCode * 59 + this.GeneralMasterData.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;
        }
    }
}
