/* 
 * 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>
    /// CompleteTransaction &lt;emph&gt;undocumented&lt;/emph&gt;
    /// </summary>
    [DataContract]
    public partial class ComGkSoftwareGkrApiTxpoolDtoCompleteTransaction :  IEquatable<ComGkSoftwareGkrApiTxpoolDtoCompleteTransaction>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ComGkSoftwareGkrApiTxpoolDtoCompleteTransaction" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected ComGkSoftwareGkrApiTxpoolDtoCompleteTransaction() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComGkSoftwareGkrApiTxpoolDtoCompleteTransaction" /> class.
        /// </summary>
        /// <param name="key">&lt;p&gt;Getter for inner key class.&lt;/p&gt; (required).</param>
        /// <param name="correlatedToList">List of transactions that influence meaning of of the transaction.</param>
        /// <param name="onlineChecked">True if this transaction state was checked against central service.False means that the state might not be quite right, but we optimisticallyallow client to continue. (required).</param>
        /// <param name="checksum">Checksum of correlated transactions, to be used while construction correlation attributes (required).</param>
        public ComGkSoftwareGkrApiTxpoolDtoCompleteTransaction(ComGkSoftwareGkrApiTxpoolDtoCompleteTransactionKey key = default(ComGkSoftwareGkrApiTxpoolDtoCompleteTransactionKey), List<ComGkSoftwareGkrApiTxpoolDtoTransaction> correlatedToList = default(List<ComGkSoftwareGkrApiTxpoolDtoTransaction>), bool? onlineChecked = default(bool?), string checksum = default(string))
        {
            // to ensure "key" is required (not null)
            if (key == null)
            {
                throw new InvalidDataException("key is a required property for ComGkSoftwareGkrApiTxpoolDtoCompleteTransaction and cannot be null");
            }
            else
            {
                this.Key = key;
            }
            // to ensure "onlineChecked" is required (not null)
            if (onlineChecked == null)
            {
                throw new InvalidDataException("onlineChecked is a required property for ComGkSoftwareGkrApiTxpoolDtoCompleteTransaction and cannot be null");
            }
            else
            {
                this.OnlineChecked = onlineChecked;
            }
            // to ensure "checksum" is required (not null)
            if (checksum == null)
            {
                throw new InvalidDataException("checksum is a required property for ComGkSoftwareGkrApiTxpoolDtoCompleteTransaction and cannot be null");
            }
            else
            {
                this.Checksum = checksum;
            }
            this.CorrelatedToList = correlatedToList;
        }
        
        /// <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 ComGkSoftwareGkrApiTxpoolDtoCompleteTransactionKey Key { get; set; }

        /// <summary>
        /// List of transactions that influence meaning of of the transaction
        /// </summary>
        /// <value>List of transactions that influence meaning of of the transaction</value>
        [DataMember(Name="correlatedToList", EmitDefaultValue=false)]
        public List<ComGkSoftwareGkrApiTxpoolDtoTransaction> CorrelatedToList { get; set; }

        /// <summary>
        /// True if this transaction state was checked against central service.False means that the state might not be quite right, but we optimisticallyallow client to continue.
        /// </summary>
        /// <value>True if this transaction state was checked against central service.False means that the state might not be quite right, but we optimisticallyallow client to continue.</value>
        [DataMember(Name="onlineChecked", EmitDefaultValue=false)]
        public bool? OnlineChecked { get; set; }

        /// <summary>
        /// Checksum of correlated transactions, to be used while construction correlation attributes
        /// </summary>
        /// <value>Checksum of correlated transactions, to be used while construction correlation attributes</value>
        [DataMember(Name="checksum", EmitDefaultValue=false)]
        public string Checksum { 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 ComGkSoftwareGkrApiTxpoolDtoCompleteTransaction {\n");
            sb.Append("  Key: ").Append(Key).Append("\n");
            sb.Append("  CorrelatedToList: ").Append(CorrelatedToList).Append("\n");
            sb.Append("  OnlineChecked: ").Append(OnlineChecked).Append("\n");
            sb.Append("  Checksum: ").Append(Checksum).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 ComGkSoftwareGkrApiTxpoolDtoCompleteTransaction);
        }

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

            return 
                (
                    this.Key == input.Key ||
                    (this.Key != null &&
                    this.Key.Equals(input.Key))
                ) && 
                (
                    this.CorrelatedToList == input.CorrelatedToList ||
                    this.CorrelatedToList != null &&
                    this.CorrelatedToList.SequenceEqual(input.CorrelatedToList)
                ) && 
                (
                    this.OnlineChecked == input.OnlineChecked ||
                    (this.OnlineChecked != null &&
                    this.OnlineChecked.Equals(input.OnlineChecked))
                ) && 
                (
                    this.Checksum == input.Checksum ||
                    (this.Checksum != null &&
                    this.Checksum.Equals(input.Checksum))
                );
        }

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

}
