/* 
 * 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>
    /// RefundTransaction &lt;emph&gt;undocumented&lt;/emph&gt;
    /// </summary>
    [DataContract]
    public partial class ComGkSoftwareGkrApiRefundServiceDtoRefundTransaction :  IEquatable<ComGkSoftwareGkrApiRefundServiceDtoRefundTransaction>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ComGkSoftwareGkrApiRefundServiceDtoRefundTransaction" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected ComGkSoftwareGkrApiRefundServiceDtoRefundTransaction() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComGkSoftwareGkrApiRefundServiceDtoRefundTransaction" /> class.
        /// </summary>
        /// <param name="transaction">transaction data of the loaded transaction (required).</param>
        /// <param name="checksum">Transaction checksum, mandatory parameter for checked calls (required).</param>
        /// <param name="lineItemRefundDataList">list of RefundData of line items.</param>
        public ComGkSoftwareGkrApiRefundServiceDtoRefundTransaction(ComGkSoftwareGkrApiTxpoolDtoTransaction transaction = default(ComGkSoftwareGkrApiTxpoolDtoTransaction), string checksum = default(string), List<ComGkSoftwareGkrApiRefundServiceDtoLineItemRefundData> lineItemRefundDataList = default(List<ComGkSoftwareGkrApiRefundServiceDtoLineItemRefundData>))
        {
            // to ensure "transaction" is required (not null)
            if (transaction == null)
            {
                throw new InvalidDataException("transaction is a required property for ComGkSoftwareGkrApiRefundServiceDtoRefundTransaction and cannot be null");
            }
            else
            {
                this.Transaction = transaction;
            }
            // to ensure "checksum" is required (not null)
            if (checksum == null)
            {
                throw new InvalidDataException("checksum is a required property for ComGkSoftwareGkrApiRefundServiceDtoRefundTransaction and cannot be null");
            }
            else
            {
                this.Checksum = checksum;
            }
            this.LineItemRefundDataList = lineItemRefundDataList;
        }
        
        /// <summary>
        /// transaction data of the loaded transaction
        /// </summary>
        /// <value>transaction data of the loaded transaction</value>
        [DataMember(Name="transaction", EmitDefaultValue=false)]
        public ComGkSoftwareGkrApiTxpoolDtoTransaction Transaction { get; set; }

        /// <summary>
        /// Transaction checksum, mandatory parameter for checked calls
        /// </summary>
        /// <value>Transaction checksum, mandatory parameter for checked calls</value>
        [DataMember(Name="checksum", EmitDefaultValue=false)]
        public string Checksum { get; set; }

        /// <summary>
        /// list of RefundData of line items
        /// </summary>
        /// <value>list of RefundData of line items</value>
        [DataMember(Name="lineItemRefundDataList", EmitDefaultValue=false)]
        public List<ComGkSoftwareGkrApiRefundServiceDtoLineItemRefundData> LineItemRefundDataList { 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 ComGkSoftwareGkrApiRefundServiceDtoRefundTransaction {\n");
            sb.Append("  Transaction: ").Append(Transaction).Append("\n");
            sb.Append("  Checksum: ").Append(Checksum).Append("\n");
            sb.Append("  LineItemRefundDataList: ").Append(LineItemRefundDataList).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 ComGkSoftwareGkrApiRefundServiceDtoRefundTransaction);
        }

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

            return 
                (
                    this.Transaction == input.Transaction ||
                    (this.Transaction != null &&
                    this.Transaction.Equals(input.Transaction))
                ) && 
                (
                    this.Checksum == input.Checksum ||
                    (this.Checksum != null &&
                    this.Checksum.Equals(input.Checksum))
                ) && 
                (
                    this.LineItemRefundDataList == input.LineItemRefundDataList ||
                    this.LineItemRefundDataList != null &&
                    this.LineItemRefundDataList.SequenceEqual(input.LineItemRefundDataList)
                );
        }

        /// <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.Transaction != null)
                    hashCode = hashCode * 59 + this.Transaction.GetHashCode();
                if (this.Checksum != null)
                    hashCode = hashCode * 59 + this.Checksum.GetHashCode();
                if (this.LineItemRefundDataList != null)
                    hashCode = hashCode * 59 + this.LineItemRefundDataList.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;
        }
    }

}
