/* 
 * GK application - OmniPOS Service API
 *
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: 5.21.1-b03
 * 
 * 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>
    /// RetailTransactionLineItemAssociation.Key Inner class for composite key attributes
    /// </summary>
    [DataContract]
    public partial class ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey :  IEquatable<ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey" /> class.
        /// </summary>
        /// <param name="businessUnitGroupID">A unique system assigned identifier for a group of BusinessUnits. (required).</param>
        /// <param name="transactionID">A universally unique identifier (UUID) for the Transaction. (required).</param>
        /// <param name="lineItemSequenceNumber">The sequence number of line item (required).</param>
        /// <param name="toTransactionID">The transaction id of the linked transaction. (required).</param>
        /// <param name="toLineItemSequenceNumber">The sequence number of the linked line item. (required).</param>
        /// <param name="lineItemAssociationTypeCode">A retailer assigned code denoting the relationship between the two items. (required).</param>
        /// <param name="toBusinessUnitGroupID">A unique system assigned identifier for the the business unit group of the linked transaction. (required).</param>
        public ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey(string businessUnitGroupID = default(string), string transactionID = default(string), int? lineItemSequenceNumber = default(int?), string toTransactionID = default(string), int? toLineItemSequenceNumber = default(int?), string lineItemAssociationTypeCode = default(string), string toBusinessUnitGroupID = default(string))
        {
            // to ensure "businessUnitGroupID" is required (not null)
            if (businessUnitGroupID == null)
            {
                throw new InvalidDataException("businessUnitGroupID is a required property for ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey and cannot be null");
            }
            else
            {
                this.BusinessUnitGroupID = businessUnitGroupID;
            }
            // to ensure "transactionID" is required (not null)
            if (transactionID == null)
            {
                throw new InvalidDataException("transactionID is a required property for ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey and cannot be null");
            }
            else
            {
                this.TransactionID = transactionID;
            }
            // to ensure "lineItemSequenceNumber" is required (not null)
            if (lineItemSequenceNumber == null)
            {
                throw new InvalidDataException("lineItemSequenceNumber is a required property for ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey and cannot be null");
            }
            else
            {
                this.LineItemSequenceNumber = lineItemSequenceNumber;
            }
            // to ensure "toTransactionID" is required (not null)
            if (toTransactionID == null)
            {
                throw new InvalidDataException("toTransactionID is a required property for ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey and cannot be null");
            }
            else
            {
                this.ToTransactionID = toTransactionID;
            }
            // to ensure "toLineItemSequenceNumber" is required (not null)
            if (toLineItemSequenceNumber == null)
            {
                throw new InvalidDataException("toLineItemSequenceNumber is a required property for ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey and cannot be null");
            }
            else
            {
                this.ToLineItemSequenceNumber = toLineItemSequenceNumber;
            }
            // to ensure "lineItemAssociationTypeCode" is required (not null)
            if (lineItemAssociationTypeCode == null)
            {
                throw new InvalidDataException("lineItemAssociationTypeCode is a required property for ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey and cannot be null");
            }
            else
            {
                this.LineItemAssociationTypeCode = lineItemAssociationTypeCode;
            }
            // to ensure "toBusinessUnitGroupID" is required (not null)
            if (toBusinessUnitGroupID == null)
            {
                throw new InvalidDataException("toBusinessUnitGroupID is a required property for ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey and cannot be null");
            }
            else
            {
                this.ToBusinessUnitGroupID = toBusinessUnitGroupID;
            }
        }
        
        /// <summary>
        /// A unique system assigned identifier for a group of BusinessUnits.
        /// </summary>
        /// <value>A unique system assigned identifier for a group of BusinessUnits.</value>
        [DataMember(Name="businessUnitGroupID", EmitDefaultValue=false)]
        public string BusinessUnitGroupID { get; set; }

        /// <summary>
        /// A universally unique identifier (UUID) for the Transaction.
        /// </summary>
        /// <value>A universally unique identifier (UUID) for the Transaction.</value>
        [DataMember(Name="transactionID", EmitDefaultValue=false)]
        public string TransactionID { get; set; }

        /// <summary>
        /// The sequence number of line item
        /// </summary>
        /// <value>The sequence number of line item</value>
        [DataMember(Name="lineItemSequenceNumber", EmitDefaultValue=false)]
        public int? LineItemSequenceNumber { get; set; }

        /// <summary>
        /// The transaction id of the linked transaction.
        /// </summary>
        /// <value>The transaction id of the linked transaction.</value>
        [DataMember(Name="toTransactionID", EmitDefaultValue=false)]
        public string ToTransactionID { get; set; }

        /// <summary>
        /// The sequence number of the linked line item.
        /// </summary>
        /// <value>The sequence number of the linked line item.</value>
        [DataMember(Name="toLineItemSequenceNumber", EmitDefaultValue=false)]
        public int? ToLineItemSequenceNumber { get; set; }

        /// <summary>
        /// A retailer assigned code denoting the relationship between the two items.
        /// </summary>
        /// <value>A retailer assigned code denoting the relationship between the two items.</value>
        [DataMember(Name="lineItemAssociationTypeCode", EmitDefaultValue=false)]
        public string LineItemAssociationTypeCode { get; set; }

        /// <summary>
        /// A unique system assigned identifier for the the business unit group of the linked transaction.
        /// </summary>
        /// <value>A unique system assigned identifier for the the business unit group of the linked transaction.</value>
        [DataMember(Name="toBusinessUnitGroupID", EmitDefaultValue=false)]
        public string ToBusinessUnitGroupID { 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 ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey {\n");
            sb.Append("  BusinessUnitGroupID: ").Append(BusinessUnitGroupID).Append("\n");
            sb.Append("  TransactionID: ").Append(TransactionID).Append("\n");
            sb.Append("  LineItemSequenceNumber: ").Append(LineItemSequenceNumber).Append("\n");
            sb.Append("  ToTransactionID: ").Append(ToTransactionID).Append("\n");
            sb.Append("  ToLineItemSequenceNumber: ").Append(ToLineItemSequenceNumber).Append("\n");
            sb.Append("  LineItemAssociationTypeCode: ").Append(LineItemAssociationTypeCode).Append("\n");
            sb.Append("  ToBusinessUnitGroupID: ").Append(ToBusinessUnitGroupID).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 ComGkSoftwareGkrApiTxpoolDtoRetailTransactionLineItemAssociationKey);
        }

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

            return 
                (
                    this.BusinessUnitGroupID == input.BusinessUnitGroupID ||
                    (this.BusinessUnitGroupID != null &&
                    this.BusinessUnitGroupID.Equals(input.BusinessUnitGroupID))
                ) && 
                (
                    this.TransactionID == input.TransactionID ||
                    (this.TransactionID != null &&
                    this.TransactionID.Equals(input.TransactionID))
                ) && 
                (
                    this.LineItemSequenceNumber == input.LineItemSequenceNumber ||
                    (this.LineItemSequenceNumber != null &&
                    this.LineItemSequenceNumber.Equals(input.LineItemSequenceNumber))
                ) && 
                (
                    this.ToTransactionID == input.ToTransactionID ||
                    (this.ToTransactionID != null &&
                    this.ToTransactionID.Equals(input.ToTransactionID))
                ) && 
                (
                    this.ToLineItemSequenceNumber == input.ToLineItemSequenceNumber ||
                    (this.ToLineItemSequenceNumber != null &&
                    this.ToLineItemSequenceNumber.Equals(input.ToLineItemSequenceNumber))
                ) && 
                (
                    this.LineItemAssociationTypeCode == input.LineItemAssociationTypeCode ||
                    (this.LineItemAssociationTypeCode != null &&
                    this.LineItemAssociationTypeCode.Equals(input.LineItemAssociationTypeCode))
                ) && 
                (
                    this.ToBusinessUnitGroupID == input.ToBusinessUnitGroupID ||
                    (this.ToBusinessUnitGroupID != null &&
                    this.ToBusinessUnitGroupID.Equals(input.ToBusinessUnitGroupID))
                );
        }

        /// <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.BusinessUnitGroupID != null)
                    hashCode = hashCode * 59 + this.BusinessUnitGroupID.GetHashCode();
                if (this.TransactionID != null)
                    hashCode = hashCode * 59 + this.TransactionID.GetHashCode();
                if (this.LineItemSequenceNumber != null)
                    hashCode = hashCode * 59 + this.LineItemSequenceNumber.GetHashCode();
                if (this.ToTransactionID != null)
                    hashCode = hashCode * 59 + this.ToTransactionID.GetHashCode();
                if (this.ToLineItemSequenceNumber != null)
                    hashCode = hashCode * 59 + this.ToLineItemSequenceNumber.GetHashCode();
                if (this.LineItemAssociationTypeCode != null)
                    hashCode = hashCode * 59 + this.LineItemAssociationTypeCode.GetHashCode();
                if (this.ToBusinessUnitGroupID != null)
                    hashCode = hashCode * 59 + this.ToBusinessUnitGroupID.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;
        }
    }

}
