/* 
 * 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>
    /// CG4E_CFCOINTESTATI - Cointestatari&lt;br&gt;Proprietà chiave:&lt;ul&gt;&lt;li&gt;&lt;b&gt;CliforCg44&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;CliforcoCg44&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;DittaCg18&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;TipocfCg44&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;
    /// </summary>
    [DataContract]
        public partial class CSJointlyHeldCODTO :  IEquatable<CSJointlyHeldCODTO>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="CSJointlyHeldCODTO" /> class.
        /// </summary>
        /// <param name="cliforCg44">CG4E_CLIFOR_CG44 - Codice Cliente / Fornitore (required).</param>
        /// <param name="cliforcoCg44">CG4E_CLIFORCO_CG44 -  Cliente/Fornitore cointestatario (required).</param>
        /// <param name="dittaCg18">CG4E_DITTA_CG18 - Ditta (required).</param>
        /// <param name="idcliforcoCg44">CG4E_IDCLIFORCO_CG44 - Tipo Cliente / Fornitore.</param>
        /// <param name="percentuale">CG4E_PERCENTUALE - Percentuale (required).</param>
        /// <param name="tipocfCg44">CG4E_TIPOCF_CG44 - Tipo Cliente / Fornitore (required).</param>
        /// <param name="customerSupplierCO">customerSupplierCO (required).</param>
        /// <param name="additionalData">additionalData.</param>
        /// <param name="pluginData">pluginData.</param>
        public CSJointlyHeldCODTO(double? cliforCg44 = default(double?), double? cliforcoCg44 = default(double?), double? dittaCg18 = default(double?), int? idcliforcoCg44 = default(int?), double? percentuale = default(double?), double? tipocfCg44 = default(double?), CustomerSupplierCODTO customerSupplierCO = default(CustomerSupplierCODTO), Dictionary<string, Object> additionalData = default(Dictionary<string, Object>), Dictionary<string, Object> pluginData = default(Dictionary<string, Object>))
        {
            // to ensure "cliforCg44" is required (not null)
            if (cliforCg44 == null)
            {
                throw new InvalidDataException("cliforCg44 is a required property for CSJointlyHeldCODTO and cannot be null");
            }
            else
            {
                this.CliforCg44 = cliforCg44;
            }
            // to ensure "cliforcoCg44" is required (not null)
            if (cliforcoCg44 == null)
            {
                throw new InvalidDataException("cliforcoCg44 is a required property for CSJointlyHeldCODTO and cannot be null");
            }
            else
            {
                this.CliforcoCg44 = cliforcoCg44;
            }
            // to ensure "dittaCg18" is required (not null)
            if (dittaCg18 == null)
            {
                throw new InvalidDataException("dittaCg18 is a required property for CSJointlyHeldCODTO and cannot be null");
            }
            else
            {
                this.DittaCg18 = dittaCg18;
            }
            // to ensure "percentuale" is required (not null)
            if (percentuale == null)
            {
                throw new InvalidDataException("percentuale is a required property for CSJointlyHeldCODTO and cannot be null");
            }
            else
            {
                this.Percentuale = percentuale;
            }
            // to ensure "tipocfCg44" is required (not null)
            if (tipocfCg44 == null)
            {
                throw new InvalidDataException("tipocfCg44 is a required property for CSJointlyHeldCODTO and cannot be null");
            }
            else
            {
                this.TipocfCg44 = tipocfCg44;
            }
            // to ensure "customerSupplierCO" is required (not null)
            if (customerSupplierCO == null)
            {
                throw new InvalidDataException("customerSupplierCO is a required property for CSJointlyHeldCODTO and cannot be null");
            }
            else
            {
                this.CustomerSupplierCO = customerSupplierCO;
            }
            this.IdcliforcoCg44 = idcliforcoCg44;
            this.AdditionalData = additionalData;
            this.PluginData = pluginData;
        }
        
        /// <summary>
        /// CG4E_CLIFOR_CG44 - Codice Cliente / Fornitore
        /// </summary>
        /// <value>CG4E_CLIFOR_CG44 - Codice Cliente / Fornitore</value>
        [DataMember(Name="cliforCg44", EmitDefaultValue=false)]
        public double? CliforCg44 { get; set; }

        /// <summary>
        /// CG4E_CLIFORCO_CG44 -  Cliente/Fornitore cointestatario
        /// </summary>
        /// <value>CG4E_CLIFORCO_CG44 -  Cliente/Fornitore cointestatario</value>
        [DataMember(Name="cliforcoCg44", EmitDefaultValue=false)]
        public double? CliforcoCg44 { get; set; }

        /// <summary>
        /// CG4E_DITTA_CG18 - Ditta
        /// </summary>
        /// <value>CG4E_DITTA_CG18 - Ditta</value>
        [DataMember(Name="dittaCg18", EmitDefaultValue=false)]
        public double? DittaCg18 { get; set; }

        /// <summary>
        /// CG4E_IDCLIFORCO_CG44 - Tipo Cliente / Fornitore
        /// </summary>
        /// <value>CG4E_IDCLIFORCO_CG44 - Tipo Cliente / Fornitore</value>
        [DataMember(Name="idcliforcoCg44", EmitDefaultValue=false)]
        public int? IdcliforcoCg44 { get; set; }

        /// <summary>
        /// CG4E_PERCENTUALE - Percentuale
        /// </summary>
        /// <value>CG4E_PERCENTUALE - Percentuale</value>
        [DataMember(Name="percentuale", EmitDefaultValue=false)]
        public double? Percentuale { get; set; }

        /// <summary>
        /// CG4E_TIPOCF_CG44 - Tipo Cliente / Fornitore
        /// </summary>
        /// <value>CG4E_TIPOCF_CG44 - Tipo Cliente / Fornitore</value>
        [DataMember(Name="tipocfCg44", EmitDefaultValue=false)]
        public double? TipocfCg44 { get; set; }

        /// <summary>
        /// Gets or Sets CustomerSupplierCO
        /// </summary>
        [DataMember(Name="customerSupplierCO", EmitDefaultValue=false)]
        public CustomerSupplierCODTO CustomerSupplierCO { 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 CSJointlyHeldCODTO {\n");
            sb.Append("  CliforCg44: ").Append(CliforCg44).Append("\n");
            sb.Append("  CliforcoCg44: ").Append(CliforcoCg44).Append("\n");
            sb.Append("  DittaCg18: ").Append(DittaCg18).Append("\n");
            sb.Append("  IdcliforcoCg44: ").Append(IdcliforcoCg44).Append("\n");
            sb.Append("  Percentuale: ").Append(Percentuale).Append("\n");
            sb.Append("  TipocfCg44: ").Append(TipocfCg44).Append("\n");
            sb.Append("  CustomerSupplierCO: ").Append(CustomerSupplierCO).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 CSJointlyHeldCODTO);
        }

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

            return 
                (
                    this.CliforCg44 == input.CliforCg44 ||
                    (this.CliforCg44 != null &&
                    this.CliforCg44.Equals(input.CliforCg44))
                ) && 
                (
                    this.CliforcoCg44 == input.CliforcoCg44 ||
                    (this.CliforcoCg44 != null &&
                    this.CliforcoCg44.Equals(input.CliforcoCg44))
                ) && 
                (
                    this.DittaCg18 == input.DittaCg18 ||
                    (this.DittaCg18 != null &&
                    this.DittaCg18.Equals(input.DittaCg18))
                ) && 
                (
                    this.IdcliforcoCg44 == input.IdcliforcoCg44 ||
                    (this.IdcliforcoCg44 != null &&
                    this.IdcliforcoCg44.Equals(input.IdcliforcoCg44))
                ) && 
                (
                    this.Percentuale == input.Percentuale ||
                    (this.Percentuale != null &&
                    this.Percentuale.Equals(input.Percentuale))
                ) && 
                (
                    this.TipocfCg44 == input.TipocfCg44 ||
                    (this.TipocfCg44 != null &&
                    this.TipocfCg44.Equals(input.TipocfCg44))
                ) && 
                (
                    this.CustomerSupplierCO == input.CustomerSupplierCO ||
                    (this.CustomerSupplierCO != null &&
                    this.CustomerSupplierCO.Equals(input.CustomerSupplierCO))
                ) && 
                (
                    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.CliforCg44 != null)
                    hashCode = hashCode * 59 + this.CliforCg44.GetHashCode();
                if (this.CliforcoCg44 != null)
                    hashCode = hashCode * 59 + this.CliforcoCg44.GetHashCode();
                if (this.DittaCg18 != null)
                    hashCode = hashCode * 59 + this.DittaCg18.GetHashCode();
                if (this.IdcliforcoCg44 != null)
                    hashCode = hashCode * 59 + this.IdcliforcoCg44.GetHashCode();
                if (this.Percentuale != null)
                    hashCode = hashCode * 59 + this.Percentuale.GetHashCode();
                if (this.TipocfCg44 != null)
                    hashCode = hashCode * 59 + this.TipocfCg44.GetHashCode();
                if (this.CustomerSupplierCO != null)
                    hashCode = hashCode * 59 + this.CustomerSupplierCO.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;
        }
    }
}
