/* 
 * 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>
    /// CG62_CONDPAGDES - Condizione di pagamento&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 PaymentTermCODTO :  IEquatable<PaymentTermCODTO>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="PaymentTermCODTO" /> class.
        /// </summary>
        /// <param name="codPag">CG62_CODPAG - Codice (required).</param>
        /// <param name="descPag">CG62_DESCPAG - Descrizione.</param>
        /// <param name="desPagAnal">CG62_DESPAGANAL - Descrizione analitica.</param>
        /// <param name="flgDesc">CG62_FLGDESC - Descriz. automatica  (default to 0).</param>
        /// <param name="flgDisgg">CG62_FLGDISGG - Non applicare giorni fissi cliente/fornitore - slittamento generale e cliente/fornitore (default to 0).</param>
        /// <param name="flgPrefatt">CG62_FLGPREFATT - Preferenziale ciclo attivo (default to 0).</param>
        /// <param name="flgPrefpass">CG62_FLGPREFPASS - Preferenziale ciclo passivo (default to 0).</param>
        /// <param name="flgStornoiva">CG62_FLGSTORNOIVA - Storno IVA (default to 0).</param>
        /// <param name="id">CG62_ID - ID (Required only in PUT/PATCH).</param>
        /// <param name="rowversion">CG62_ROWVERSION - RowVersion.</param>
        /// <param name="scart26">CG62_SCART26 - Sconto Art.26 importo.</param>
        /// <param name="scpercart26">CG62_SCPERCART26 - Sconto Art.26 %.</param>
        /// <param name="scpercas">CG62_SCPERCAS - Sc. cassa.</param>
        /// <param name="scpermer1">CG62_SCPERMER1 - Sc. merce 1.</param>
        /// <param name="scpermer2">CG62_SCPERMER2 - Sc. merce 2.</param>
        /// <param name="idExtendedAttributeEntity">idExtendedAttributeEntity.</param>
        /// <param name="idExtendedAttributeSubEntity">idExtendedAttributeSubEntity.</param>
        /// <param name="paymentTermDetailCO">paymentTermDetailCO.</param>
        /// <param name="extensionData">extensionData.</param>
        /// <param name="additionalData">additionalData.</param>
        /// <param name="pluginData">pluginData.</param>
        public PaymentTermCODTO(string codPag = default(string), string descPag = default(string), string desPagAnal = default(string), double? flgDesc = 0, double? flgDisgg = 0, int? flgPrefatt = 0, int? flgPrefpass = 0, double? flgStornoiva = 0, long? id = default(long?), byte[] rowversion = default(byte[]), double? scart26 = default(double?), double? scpercart26 = default(double?), double? scpercas = default(double?), double? scpermer1 = default(double?), double? scpermer2 = default(double?), int? idExtendedAttributeEntity = default(int?), int? idExtendedAttributeSubEntity = default(int?), List<PaymentTermDetailCODTO> paymentTermDetailCO = default(List<PaymentTermDetailCODTO>), List<StringObjectKeyValuePair> extensionData = default(List<StringObjectKeyValuePair>), Dictionary<string, Object> additionalData = default(Dictionary<string, Object>), Dictionary<string, Object> pluginData = default(Dictionary<string, Object>))
        {
            // to ensure "codPag" is required (not null)
            if (codPag == null)
            {
                throw new InvalidDataException("codPag is a required property for PaymentTermCODTO and cannot be null");
            }
            else
            {
                this.CodPag = codPag;
            }
            this.DescPag = descPag;
            this.DesPagAnal = desPagAnal;
            // use default value if no "flgDesc" provided
            if (flgDesc == null)
            {
                this.FlgDesc = 0;
            }
            else
            {
                this.FlgDesc = flgDesc;
            }
            // use default value if no "flgDisgg" provided
            if (flgDisgg == null)
            {
                this.FlgDisgg = 0;
            }
            else
            {
                this.FlgDisgg = flgDisgg;
            }
            // use default value if no "flgPrefatt" provided
            if (flgPrefatt == null)
            {
                this.FlgPrefatt = 0;
            }
            else
            {
                this.FlgPrefatt = flgPrefatt;
            }
            // use default value if no "flgPrefpass" provided
            if (flgPrefpass == null)
            {
                this.FlgPrefpass = 0;
            }
            else
            {
                this.FlgPrefpass = flgPrefpass;
            }
            // use default value if no "flgStornoiva" provided
            if (flgStornoiva == null)
            {
                this.FlgStornoiva = 0;
            }
            else
            {
                this.FlgStornoiva = flgStornoiva;
            }
            this.Id = id;
            this.Rowversion = rowversion;
            this.Scart26 = scart26;
            this.Scpercart26 = scpercart26;
            this.Scpercas = scpercas;
            this.Scpermer1 = scpermer1;
            this.Scpermer2 = scpermer2;
            this.IdExtendedAttributeEntity = idExtendedAttributeEntity;
            this.IdExtendedAttributeSubEntity = idExtendedAttributeSubEntity;
            this.PaymentTermDetailCO = paymentTermDetailCO;
            this.ExtensionData = extensionData;
            this.AdditionalData = additionalData;
            this.PluginData = pluginData;
        }
        
        /// <summary>
        /// CG62_CODPAG - Codice
        /// </summary>
        /// <value>CG62_CODPAG - Codice</value>
        [DataMember(Name="codPag", EmitDefaultValue=false)]
        public string CodPag { get; set; }

        /// <summary>
        /// CG62_DESCPAG - Descrizione
        /// </summary>
        /// <value>CG62_DESCPAG - Descrizione</value>
        [DataMember(Name="descPag", EmitDefaultValue=false)]
        public string DescPag { get; set; }

        /// <summary>
        /// CG62_DESPAGANAL - Descrizione analitica
        /// </summary>
        /// <value>CG62_DESPAGANAL - Descrizione analitica</value>
        [DataMember(Name="desPagAnal", EmitDefaultValue=false)]
        public string DesPagAnal { get; set; }

        /// <summary>
        /// CG62_FLGDESC - Descriz. automatica 
        /// </summary>
        /// <value>CG62_FLGDESC - Descriz. automatica </value>
        [DataMember(Name="flgDesc", EmitDefaultValue=false)]
        public double? FlgDesc { get; set; }

        /// <summary>
        /// CG62_FLGDISGG - Non applicare giorni fissi cliente/fornitore - slittamento generale e cliente/fornitore
        /// </summary>
        /// <value>CG62_FLGDISGG - Non applicare giorni fissi cliente/fornitore - slittamento generale e cliente/fornitore</value>
        [DataMember(Name="flgDisgg", EmitDefaultValue=false)]
        public double? FlgDisgg { get; set; }

        /// <summary>
        /// CG62_FLGPREFATT - Preferenziale ciclo attivo
        /// </summary>
        /// <value>CG62_FLGPREFATT - Preferenziale ciclo attivo</value>
        [DataMember(Name="flgPrefatt", EmitDefaultValue=false)]
        public int? FlgPrefatt { get; set; }

        /// <summary>
        /// CG62_FLGPREFPASS - Preferenziale ciclo passivo
        /// </summary>
        /// <value>CG62_FLGPREFPASS - Preferenziale ciclo passivo</value>
        [DataMember(Name="flgPrefpass", EmitDefaultValue=false)]
        public int? FlgPrefpass { get; set; }

        /// <summary>
        /// CG62_FLGSTORNOIVA - Storno IVA
        /// </summary>
        /// <value>CG62_FLGSTORNOIVA - Storno IVA</value>
        [DataMember(Name="flgStornoiva", EmitDefaultValue=false)]
        public double? FlgStornoiva { get; set; }

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

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

        /// <summary>
        /// CG62_SCART26 - Sconto Art.26 importo
        /// </summary>
        /// <value>CG62_SCART26 - Sconto Art.26 importo</value>
        [DataMember(Name="scart26", EmitDefaultValue=false)]
        public double? Scart26 { get; set; }

        /// <summary>
        /// CG62_SCPERCART26 - Sconto Art.26 %
        /// </summary>
        /// <value>CG62_SCPERCART26 - Sconto Art.26 %</value>
        [DataMember(Name="scpercart26", EmitDefaultValue=false)]
        public double? Scpercart26 { get; set; }

        /// <summary>
        /// CG62_SCPERCAS - Sc. cassa
        /// </summary>
        /// <value>CG62_SCPERCAS - Sc. cassa</value>
        [DataMember(Name="scpercas", EmitDefaultValue=false)]
        public double? Scpercas { get; set; }

        /// <summary>
        /// CG62_SCPERMER1 - Sc. merce 1
        /// </summary>
        /// <value>CG62_SCPERMER1 - Sc. merce 1</value>
        [DataMember(Name="scpermer1", EmitDefaultValue=false)]
        public double? Scpermer1 { get; set; }

        /// <summary>
        /// CG62_SCPERMER2 - Sc. merce 2
        /// </summary>
        /// <value>CG62_SCPERMER2 - Sc. merce 2</value>
        [DataMember(Name="scpermer2", EmitDefaultValue=false)]
        public double? Scpermer2 { get; set; }

        /// <summary>
        /// Gets or Sets IdExtendedAttributeEntity
        /// </summary>
        [DataMember(Name="idExtendedAttributeEntity", EmitDefaultValue=false)]
        public int? IdExtendedAttributeEntity { get; set; }

        /// <summary>
        /// Gets or Sets IdExtendedAttributeSubEntity
        /// </summary>
        [DataMember(Name="idExtendedAttributeSubEntity", EmitDefaultValue=false)]
        public int? IdExtendedAttributeSubEntity { get; set; }

        /// <summary>
        /// Gets or Sets PaymentTermDetailCO
        /// </summary>
        [DataMember(Name="paymentTermDetailCO", EmitDefaultValue=false)]
        public List<PaymentTermDetailCODTO> PaymentTermDetailCO { get; set; }

        /// <summary>
        /// Gets or Sets ExtensionData
        /// </summary>
        [DataMember(Name="extensionData", EmitDefaultValue=false)]
        public List<StringObjectKeyValuePair> ExtensionData { 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 PaymentTermCODTO {\n");
            sb.Append("  CodPag: ").Append(CodPag).Append("\n");
            sb.Append("  DescPag: ").Append(DescPag).Append("\n");
            sb.Append("  DesPagAnal: ").Append(DesPagAnal).Append("\n");
            sb.Append("  FlgDesc: ").Append(FlgDesc).Append("\n");
            sb.Append("  FlgDisgg: ").Append(FlgDisgg).Append("\n");
            sb.Append("  FlgPrefatt: ").Append(FlgPrefatt).Append("\n");
            sb.Append("  FlgPrefpass: ").Append(FlgPrefpass).Append("\n");
            sb.Append("  FlgStornoiva: ").Append(FlgStornoiva).Append("\n");
            sb.Append("  Id: ").Append(Id).Append("\n");
            sb.Append("  Rowversion: ").Append(Rowversion).Append("\n");
            sb.Append("  Scart26: ").Append(Scart26).Append("\n");
            sb.Append("  Scpercart26: ").Append(Scpercart26).Append("\n");
            sb.Append("  Scpercas: ").Append(Scpercas).Append("\n");
            sb.Append("  Scpermer1: ").Append(Scpermer1).Append("\n");
            sb.Append("  Scpermer2: ").Append(Scpermer2).Append("\n");
            sb.Append("  IdExtendedAttributeEntity: ").Append(IdExtendedAttributeEntity).Append("\n");
            sb.Append("  IdExtendedAttributeSubEntity: ").Append(IdExtendedAttributeSubEntity).Append("\n");
            sb.Append("  PaymentTermDetailCO: ").Append(PaymentTermDetailCO).Append("\n");
            sb.Append("  ExtensionData: ").Append(ExtensionData).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 PaymentTermCODTO);
        }

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

            return 
                (
                    this.CodPag == input.CodPag ||
                    (this.CodPag != null &&
                    this.CodPag.Equals(input.CodPag))
                ) && 
                (
                    this.DescPag == input.DescPag ||
                    (this.DescPag != null &&
                    this.DescPag.Equals(input.DescPag))
                ) && 
                (
                    this.DesPagAnal == input.DesPagAnal ||
                    (this.DesPagAnal != null &&
                    this.DesPagAnal.Equals(input.DesPagAnal))
                ) && 
                (
                    this.FlgDesc == input.FlgDesc ||
                    (this.FlgDesc != null &&
                    this.FlgDesc.Equals(input.FlgDesc))
                ) && 
                (
                    this.FlgDisgg == input.FlgDisgg ||
                    (this.FlgDisgg != null &&
                    this.FlgDisgg.Equals(input.FlgDisgg))
                ) && 
                (
                    this.FlgPrefatt == input.FlgPrefatt ||
                    (this.FlgPrefatt != null &&
                    this.FlgPrefatt.Equals(input.FlgPrefatt))
                ) && 
                (
                    this.FlgPrefpass == input.FlgPrefpass ||
                    (this.FlgPrefpass != null &&
                    this.FlgPrefpass.Equals(input.FlgPrefpass))
                ) && 
                (
                    this.FlgStornoiva == input.FlgStornoiva ||
                    (this.FlgStornoiva != null &&
                    this.FlgStornoiva.Equals(input.FlgStornoiva))
                ) && 
                (
                    this.Id == input.Id ||
                    (this.Id != null &&
                    this.Id.Equals(input.Id))
                ) && 
                (
                    this.Rowversion == input.Rowversion ||
                    (this.Rowversion != null &&
                    this.Rowversion.Equals(input.Rowversion))
                ) && 
                (
                    this.Scart26 == input.Scart26 ||
                    (this.Scart26 != null &&
                    this.Scart26.Equals(input.Scart26))
                ) && 
                (
                    this.Scpercart26 == input.Scpercart26 ||
                    (this.Scpercart26 != null &&
                    this.Scpercart26.Equals(input.Scpercart26))
                ) && 
                (
                    this.Scpercas == input.Scpercas ||
                    (this.Scpercas != null &&
                    this.Scpercas.Equals(input.Scpercas))
                ) && 
                (
                    this.Scpermer1 == input.Scpermer1 ||
                    (this.Scpermer1 != null &&
                    this.Scpermer1.Equals(input.Scpermer1))
                ) && 
                (
                    this.Scpermer2 == input.Scpermer2 ||
                    (this.Scpermer2 != null &&
                    this.Scpermer2.Equals(input.Scpermer2))
                ) && 
                (
                    this.IdExtendedAttributeEntity == input.IdExtendedAttributeEntity ||
                    (this.IdExtendedAttributeEntity != null &&
                    this.IdExtendedAttributeEntity.Equals(input.IdExtendedAttributeEntity))
                ) && 
                (
                    this.IdExtendedAttributeSubEntity == input.IdExtendedAttributeSubEntity ||
                    (this.IdExtendedAttributeSubEntity != null &&
                    this.IdExtendedAttributeSubEntity.Equals(input.IdExtendedAttributeSubEntity))
                ) && 
                (
                    this.PaymentTermDetailCO == input.PaymentTermDetailCO ||
                    this.PaymentTermDetailCO != null &&
                    input.PaymentTermDetailCO != null &&
                    this.PaymentTermDetailCO.SequenceEqual(input.PaymentTermDetailCO)
                ) && 
                (
                    this.ExtensionData == input.ExtensionData ||
                    this.ExtensionData != null &&
                    input.ExtensionData != null &&
                    this.ExtensionData.SequenceEqual(input.ExtensionData)
                ) && 
                (
                    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.CodPag != null)
                    hashCode = hashCode * 59 + this.CodPag.GetHashCode();
                if (this.DescPag != null)
                    hashCode = hashCode * 59 + this.DescPag.GetHashCode();
                if (this.DesPagAnal != null)
                    hashCode = hashCode * 59 + this.DesPagAnal.GetHashCode();
                if (this.FlgDesc != null)
                    hashCode = hashCode * 59 + this.FlgDesc.GetHashCode();
                if (this.FlgDisgg != null)
                    hashCode = hashCode * 59 + this.FlgDisgg.GetHashCode();
                if (this.FlgPrefatt != null)
                    hashCode = hashCode * 59 + this.FlgPrefatt.GetHashCode();
                if (this.FlgPrefpass != null)
                    hashCode = hashCode * 59 + this.FlgPrefpass.GetHashCode();
                if (this.FlgStornoiva != null)
                    hashCode = hashCode * 59 + this.FlgStornoiva.GetHashCode();
                if (this.Id != null)
                    hashCode = hashCode * 59 + this.Id.GetHashCode();
                if (this.Rowversion != null)
                    hashCode = hashCode * 59 + this.Rowversion.GetHashCode();
                if (this.Scart26 != null)
                    hashCode = hashCode * 59 + this.Scart26.GetHashCode();
                if (this.Scpercart26 != null)
                    hashCode = hashCode * 59 + this.Scpercart26.GetHashCode();
                if (this.Scpercas != null)
                    hashCode = hashCode * 59 + this.Scpercas.GetHashCode();
                if (this.Scpermer1 != null)
                    hashCode = hashCode * 59 + this.Scpermer1.GetHashCode();
                if (this.Scpermer2 != null)
                    hashCode = hashCode * 59 + this.Scpermer2.GetHashCode();
                if (this.IdExtendedAttributeEntity != null)
                    hashCode = hashCode * 59 + this.IdExtendedAttributeEntity.GetHashCode();
                if (this.IdExtendedAttributeSubEntity != null)
                    hashCode = hashCode * 59 + this.IdExtendedAttributeSubEntity.GetHashCode();
                if (this.PaymentTermDetailCO != null)
                    hashCode = hashCode * 59 + this.PaymentTermDetailCO.GetHashCode();
                if (this.ExtensionData != null)
                    hashCode = hashCode * 59 + this.ExtensionData.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;
        }
    }
}
