/* 
 * 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>
    /// PriceModificationLineItem &lt;emph&gt;undocumented&lt;/emph&gt;
    /// </summary>
    [DataContract]
    public partial class ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem :  IEquatable<ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem" /> class.
        /// </summary>
        /// <param name="key">&lt;p&gt;Getter for inner key class.&lt;/p&gt; (required).</param>
        /// <param name="promotionID">The unique identifier of the promotion..</param>
        /// <param name="priceDerivationRuleID">The unique identifier of the price derivation rule. .</param>
        /// <param name="priceDerivationRuleEligibilityID">The unique identifier of the root eligibility..</param>
        /// <param name="percentage">The percentage value in case of percentage price modifiers.&lt;br&gt;Fixed decimal precision expected, definition of used precision: double(13, 4). Be aware of this and round value!.</param>
        /// <param name="roundingAmount">The monetary amount that the price modification was adjusted by (after calculation from the percentage). &lt;br&gt;Fixed decimal precision expected, definition of used precision: double(16, 5). Be aware of this and round value!.</param>
        /// <param name="amount">The monetary value of the price modification that was given.  (required).</param>
        /// <param name="proRatedFlag">Indicates if this price modification was pro-rated across all of the Items in the RetailTransaction.Always true..</param>
        /// <param name="triggerSequenceNumber">The ident of the manual trigger (because a transaction item can have more than one trigger) .</param>
        /// <param name="extendedAmountBeforeModification">The retail sale total price of the transaction before applying the current price modification line item  (required).</param>
        /// <param name="extendedAmountAfterModification">The retail sale total price of the transaction before applying the current price modification line item (required).</param>
        /// <param name="extraAmount">A monetary amount which results from applying a price modification line item but does not affect the transaction total  (required).</param>
        /// <param name="externalSystemOriginatorFlag">Determines whether this entry was created by an external system - if yes, it must not be changed, but own price modifications with higher sequence may be applied (required).</param>
        /// <param name="calculationBaseAmount">The amount which was used as base for calculation of the price modification (required).</param>
        /// <param name="xxcustom05">Customizable information.</param>
        /// <param name="xxcustom03">Customizable information.</param>
        /// <param name="xxcustom02">Customizable information.</param>
        /// <param name="xxcustom04">Customizable information.</param>
        /// <param name="xxcustom01">Customizable information.</param>
        public ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem(ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItemKey key = default(ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItemKey), string promotionID = default(string), string priceDerivationRuleID = default(string), string priceDerivationRuleEligibilityID = default(string), double? percentage = default(double?), double? roundingAmount = default(double?), double? amount = default(double?), bool? proRatedFlag = default(bool?), int? triggerSequenceNumber = default(int?), double? extendedAmountBeforeModification = default(double?), double? extendedAmountAfterModification = default(double?), double? extraAmount = default(double?), bool? externalSystemOriginatorFlag = default(bool?), double? calculationBaseAmount = default(double?), string xxcustom05 = default(string), string xxcustom03 = default(string), string xxcustom02 = default(string), string xxcustom04 = default(string), string xxcustom01 = default(string))
        {
            // to ensure "key" is required (not null)
            if (key == null)
            {
                throw new InvalidDataException("key is a required property for ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem and cannot be null");
            }
            else
            {
                this.Key = key;
            }
            // to ensure "amount" is required (not null)
            if (amount == null)
            {
                throw new InvalidDataException("amount is a required property for ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem and cannot be null");
            }
            else
            {
                this.Amount = amount;
            }
            // to ensure "extendedAmountBeforeModification" is required (not null)
            if (extendedAmountBeforeModification == null)
            {
                throw new InvalidDataException("extendedAmountBeforeModification is a required property for ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem and cannot be null");
            }
            else
            {
                this.ExtendedAmountBeforeModification = extendedAmountBeforeModification;
            }
            // to ensure "extendedAmountAfterModification" is required (not null)
            if (extendedAmountAfterModification == null)
            {
                throw new InvalidDataException("extendedAmountAfterModification is a required property for ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem and cannot be null");
            }
            else
            {
                this.ExtendedAmountAfterModification = extendedAmountAfterModification;
            }
            // to ensure "extraAmount" is required (not null)
            if (extraAmount == null)
            {
                throw new InvalidDataException("extraAmount is a required property for ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem and cannot be null");
            }
            else
            {
                this.ExtraAmount = extraAmount;
            }
            // to ensure "externalSystemOriginatorFlag" is required (not null)
            if (externalSystemOriginatorFlag == null)
            {
                throw new InvalidDataException("externalSystemOriginatorFlag is a required property for ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem and cannot be null");
            }
            else
            {
                this.ExternalSystemOriginatorFlag = externalSystemOriginatorFlag;
            }
            // to ensure "calculationBaseAmount" is required (not null)
            if (calculationBaseAmount == null)
            {
                throw new InvalidDataException("calculationBaseAmount is a required property for ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem and cannot be null");
            }
            else
            {
                this.CalculationBaseAmount = calculationBaseAmount;
            }
            this.PromotionID = promotionID;
            this.PriceDerivationRuleID = priceDerivationRuleID;
            this.PriceDerivationRuleEligibilityID = priceDerivationRuleEligibilityID;
            this.Percentage = percentage;
            this.RoundingAmount = roundingAmount;
            this.ProRatedFlag = proRatedFlag;
            this.TriggerSequenceNumber = triggerSequenceNumber;
            this.Xxcustom05 = xxcustom05;
            this.Xxcustom03 = xxcustom03;
            this.Xxcustom02 = xxcustom02;
            this.Xxcustom04 = xxcustom04;
            this.Xxcustom01 = xxcustom01;
        }
        
        /// <summary>
        /// &lt;p&gt;Getter for inner key class.&lt;/p&gt;
        /// </summary>
        /// <value>&lt;p&gt;Getter for inner key class.&lt;/p&gt;</value>
        [DataMember(Name="key", EmitDefaultValue=false)]
        public ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItemKey Key { get; set; }

        /// <summary>
        /// The unique identifier of the promotion.
        /// </summary>
        /// <value>The unique identifier of the promotion.</value>
        [DataMember(Name="promotionID", EmitDefaultValue=false)]
        public string PromotionID { get; set; }

        /// <summary>
        /// The unique identifier of the price derivation rule. 
        /// </summary>
        /// <value>The unique identifier of the price derivation rule. </value>
        [DataMember(Name="priceDerivationRuleID", EmitDefaultValue=false)]
        public string PriceDerivationRuleID { get; set; }

        /// <summary>
        /// The unique identifier of the root eligibility.
        /// </summary>
        /// <value>The unique identifier of the root eligibility.</value>
        [DataMember(Name="priceDerivationRuleEligibilityID", EmitDefaultValue=false)]
        public string PriceDerivationRuleEligibilityID { get; set; }

        /// <summary>
        /// The percentage value in case of percentage price modifiers.&lt;br&gt;Fixed decimal precision expected, definition of used precision: double(13, 4). Be aware of this and round value!
        /// </summary>
        /// <value>The percentage value in case of percentage price modifiers.&lt;br&gt;Fixed decimal precision expected, definition of used precision: double(13, 4). Be aware of this and round value!</value>
        [DataMember(Name="percentage", EmitDefaultValue=false)]
        public double? Percentage { get; set; }

        /// <summary>
        /// The monetary amount that the price modification was adjusted by (after calculation from the percentage). &lt;br&gt;Fixed decimal precision expected, definition of used precision: double(16, 5). Be aware of this and round value!
        /// </summary>
        /// <value>The monetary amount that the price modification was adjusted by (after calculation from the percentage). &lt;br&gt;Fixed decimal precision expected, definition of used precision: double(16, 5). Be aware of this and round value!</value>
        [DataMember(Name="roundingAmount", EmitDefaultValue=false)]
        public double? RoundingAmount { get; set; }

        /// <summary>
        /// The monetary value of the price modification that was given. 
        /// </summary>
        /// <value>The monetary value of the price modification that was given. </value>
        [DataMember(Name="amount", EmitDefaultValue=false)]
        public double? Amount { get; set; }

        /// <summary>
        /// Indicates if this price modification was pro-rated across all of the Items in the RetailTransaction.Always true.
        /// </summary>
        /// <value>Indicates if this price modification was pro-rated across all of the Items in the RetailTransaction.Always true.</value>
        [DataMember(Name="proRatedFlag", EmitDefaultValue=false)]
        public bool? ProRatedFlag { get; set; }

        /// <summary>
        /// The ident of the manual trigger (because a transaction item can have more than one trigger) 
        /// </summary>
        /// <value>The ident of the manual trigger (because a transaction item can have more than one trigger) </value>
        [DataMember(Name="triggerSequenceNumber", EmitDefaultValue=false)]
        public int? TriggerSequenceNumber { get; set; }

        /// <summary>
        /// The retail sale total price of the transaction before applying the current price modification line item 
        /// </summary>
        /// <value>The retail sale total price of the transaction before applying the current price modification line item </value>
        [DataMember(Name="extendedAmountBeforeModification", EmitDefaultValue=false)]
        public double? ExtendedAmountBeforeModification { get; set; }

        /// <summary>
        /// The retail sale total price of the transaction before applying the current price modification line item
        /// </summary>
        /// <value>The retail sale total price of the transaction before applying the current price modification line item</value>
        [DataMember(Name="extendedAmountAfterModification", EmitDefaultValue=false)]
        public double? ExtendedAmountAfterModification { get; set; }

        /// <summary>
        /// A monetary amount which results from applying a price modification line item but does not affect the transaction total 
        /// </summary>
        /// <value>A monetary amount which results from applying a price modification line item but does not affect the transaction total </value>
        [DataMember(Name="extraAmount", EmitDefaultValue=false)]
        public double? ExtraAmount { get; set; }

        /// <summary>
        /// Determines whether this entry was created by an external system - if yes, it must not be changed, but own price modifications with higher sequence may be applied
        /// </summary>
        /// <value>Determines whether this entry was created by an external system - if yes, it must not be changed, but own price modifications with higher sequence may be applied</value>
        [DataMember(Name="externalSystemOriginatorFlag", EmitDefaultValue=false)]
        public bool? ExternalSystemOriginatorFlag { get; set; }

        /// <summary>
        /// The amount which was used as base for calculation of the price modification
        /// </summary>
        /// <value>The amount which was used as base for calculation of the price modification</value>
        [DataMember(Name="calculationBaseAmount", EmitDefaultValue=false)]
        public double? CalculationBaseAmount { get; set; }

        /// <summary>
        /// Customizable information
        /// </summary>
        /// <value>Customizable information</value>
        [DataMember(Name="xxcustom05", EmitDefaultValue=false)]
        public string Xxcustom05 { get; set; }

        /// <summary>
        /// Customizable information
        /// </summary>
        /// <value>Customizable information</value>
        [DataMember(Name="xxcustom03", EmitDefaultValue=false)]
        public string Xxcustom03 { get; set; }

        /// <summary>
        /// Customizable information
        /// </summary>
        /// <value>Customizable information</value>
        [DataMember(Name="xxcustom02", EmitDefaultValue=false)]
        public string Xxcustom02 { get; set; }

        /// <summary>
        /// Customizable information
        /// </summary>
        /// <value>Customizable information</value>
        [DataMember(Name="xxcustom04", EmitDefaultValue=false)]
        public string Xxcustom04 { get; set; }

        /// <summary>
        /// Customizable information
        /// </summary>
        /// <value>Customizable information</value>
        [DataMember(Name="xxcustom01", EmitDefaultValue=false)]
        public string Xxcustom01 { 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 ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem {\n");
            sb.Append("  Key: ").Append(Key).Append("\n");
            sb.Append("  PromotionID: ").Append(PromotionID).Append("\n");
            sb.Append("  PriceDerivationRuleID: ").Append(PriceDerivationRuleID).Append("\n");
            sb.Append("  PriceDerivationRuleEligibilityID: ").Append(PriceDerivationRuleEligibilityID).Append("\n");
            sb.Append("  Percentage: ").Append(Percentage).Append("\n");
            sb.Append("  RoundingAmount: ").Append(RoundingAmount).Append("\n");
            sb.Append("  Amount: ").Append(Amount).Append("\n");
            sb.Append("  ProRatedFlag: ").Append(ProRatedFlag).Append("\n");
            sb.Append("  TriggerSequenceNumber: ").Append(TriggerSequenceNumber).Append("\n");
            sb.Append("  ExtendedAmountBeforeModification: ").Append(ExtendedAmountBeforeModification).Append("\n");
            sb.Append("  ExtendedAmountAfterModification: ").Append(ExtendedAmountAfterModification).Append("\n");
            sb.Append("  ExtraAmount: ").Append(ExtraAmount).Append("\n");
            sb.Append("  ExternalSystemOriginatorFlag: ").Append(ExternalSystemOriginatorFlag).Append("\n");
            sb.Append("  CalculationBaseAmount: ").Append(CalculationBaseAmount).Append("\n");
            sb.Append("  Xxcustom05: ").Append(Xxcustom05).Append("\n");
            sb.Append("  Xxcustom03: ").Append(Xxcustom03).Append("\n");
            sb.Append("  Xxcustom02: ").Append(Xxcustom02).Append("\n");
            sb.Append("  Xxcustom04: ").Append(Xxcustom04).Append("\n");
            sb.Append("  Xxcustom01: ").Append(Xxcustom01).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 ComGkSoftwareGkrApiTxpoolDtoPriceModificationLineItem);
        }

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

            return 
                (
                    this.Key == input.Key ||
                    (this.Key != null &&
                    this.Key.Equals(input.Key))
                ) && 
                (
                    this.PromotionID == input.PromotionID ||
                    (this.PromotionID != null &&
                    this.PromotionID.Equals(input.PromotionID))
                ) && 
                (
                    this.PriceDerivationRuleID == input.PriceDerivationRuleID ||
                    (this.PriceDerivationRuleID != null &&
                    this.PriceDerivationRuleID.Equals(input.PriceDerivationRuleID))
                ) && 
                (
                    this.PriceDerivationRuleEligibilityID == input.PriceDerivationRuleEligibilityID ||
                    (this.PriceDerivationRuleEligibilityID != null &&
                    this.PriceDerivationRuleEligibilityID.Equals(input.PriceDerivationRuleEligibilityID))
                ) && 
                (
                    this.Percentage == input.Percentage ||
                    (this.Percentage != null &&
                    this.Percentage.Equals(input.Percentage))
                ) && 
                (
                    this.RoundingAmount == input.RoundingAmount ||
                    (this.RoundingAmount != null &&
                    this.RoundingAmount.Equals(input.RoundingAmount))
                ) && 
                (
                    this.Amount == input.Amount ||
                    (this.Amount != null &&
                    this.Amount.Equals(input.Amount))
                ) && 
                (
                    this.ProRatedFlag == input.ProRatedFlag ||
                    (this.ProRatedFlag != null &&
                    this.ProRatedFlag.Equals(input.ProRatedFlag))
                ) && 
                (
                    this.TriggerSequenceNumber == input.TriggerSequenceNumber ||
                    (this.TriggerSequenceNumber != null &&
                    this.TriggerSequenceNumber.Equals(input.TriggerSequenceNumber))
                ) && 
                (
                    this.ExtendedAmountBeforeModification == input.ExtendedAmountBeforeModification ||
                    (this.ExtendedAmountBeforeModification != null &&
                    this.ExtendedAmountBeforeModification.Equals(input.ExtendedAmountBeforeModification))
                ) && 
                (
                    this.ExtendedAmountAfterModification == input.ExtendedAmountAfterModification ||
                    (this.ExtendedAmountAfterModification != null &&
                    this.ExtendedAmountAfterModification.Equals(input.ExtendedAmountAfterModification))
                ) && 
                (
                    this.ExtraAmount == input.ExtraAmount ||
                    (this.ExtraAmount != null &&
                    this.ExtraAmount.Equals(input.ExtraAmount))
                ) && 
                (
                    this.ExternalSystemOriginatorFlag == input.ExternalSystemOriginatorFlag ||
                    (this.ExternalSystemOriginatorFlag != null &&
                    this.ExternalSystemOriginatorFlag.Equals(input.ExternalSystemOriginatorFlag))
                ) && 
                (
                    this.CalculationBaseAmount == input.CalculationBaseAmount ||
                    (this.CalculationBaseAmount != null &&
                    this.CalculationBaseAmount.Equals(input.CalculationBaseAmount))
                ) && 
                (
                    this.Xxcustom05 == input.Xxcustom05 ||
                    (this.Xxcustom05 != null &&
                    this.Xxcustom05.Equals(input.Xxcustom05))
                ) && 
                (
                    this.Xxcustom03 == input.Xxcustom03 ||
                    (this.Xxcustom03 != null &&
                    this.Xxcustom03.Equals(input.Xxcustom03))
                ) && 
                (
                    this.Xxcustom02 == input.Xxcustom02 ||
                    (this.Xxcustom02 != null &&
                    this.Xxcustom02.Equals(input.Xxcustom02))
                ) && 
                (
                    this.Xxcustom04 == input.Xxcustom04 ||
                    (this.Xxcustom04 != null &&
                    this.Xxcustom04.Equals(input.Xxcustom04))
                ) && 
                (
                    this.Xxcustom01 == input.Xxcustom01 ||
                    (this.Xxcustom01 != null &&
                    this.Xxcustom01.Equals(input.Xxcustom01))
                );
        }

        /// <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.Key != null)
                    hashCode = hashCode * 59 + this.Key.GetHashCode();
                if (this.PromotionID != null)
                    hashCode = hashCode * 59 + this.PromotionID.GetHashCode();
                if (this.PriceDerivationRuleID != null)
                    hashCode = hashCode * 59 + this.PriceDerivationRuleID.GetHashCode();
                if (this.PriceDerivationRuleEligibilityID != null)
                    hashCode = hashCode * 59 + this.PriceDerivationRuleEligibilityID.GetHashCode();
                if (this.Percentage != null)
                    hashCode = hashCode * 59 + this.Percentage.GetHashCode();
                if (this.RoundingAmount != null)
                    hashCode = hashCode * 59 + this.RoundingAmount.GetHashCode();
                if (this.Amount != null)
                    hashCode = hashCode * 59 + this.Amount.GetHashCode();
                if (this.ProRatedFlag != null)
                    hashCode = hashCode * 59 + this.ProRatedFlag.GetHashCode();
                if (this.TriggerSequenceNumber != null)
                    hashCode = hashCode * 59 + this.TriggerSequenceNumber.GetHashCode();
                if (this.ExtendedAmountBeforeModification != null)
                    hashCode = hashCode * 59 + this.ExtendedAmountBeforeModification.GetHashCode();
                if (this.ExtendedAmountAfterModification != null)
                    hashCode = hashCode * 59 + this.ExtendedAmountAfterModification.GetHashCode();
                if (this.ExtraAmount != null)
                    hashCode = hashCode * 59 + this.ExtraAmount.GetHashCode();
                if (this.ExternalSystemOriginatorFlag != null)
                    hashCode = hashCode * 59 + this.ExternalSystemOriginatorFlag.GetHashCode();
                if (this.CalculationBaseAmount != null)
                    hashCode = hashCode * 59 + this.CalculationBaseAmount.GetHashCode();
                if (this.Xxcustom05 != null)
                    hashCode = hashCode * 59 + this.Xxcustom05.GetHashCode();
                if (this.Xxcustom03 != null)
                    hashCode = hashCode * 59 + this.Xxcustom03.GetHashCode();
                if (this.Xxcustom02 != null)
                    hashCode = hashCode * 59 + this.Xxcustom02.GetHashCode();
                if (this.Xxcustom04 != null)
                    hashCode = hashCode * 59 + this.Xxcustom04.GetHashCode();
                if (this.Xxcustom01 != null)
                    hashCode = hashCode * 59 + this.Xxcustom01.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;
        }
    }

}
