<reponame>passiv/snaptrade-sdks/*
 * SnapTrade
 *
 * Connect brokerage accounts to your app for live positions and trading
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: lyhxr@example.com
 * Generated by: https://konfigthis.com
 */


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = SnapTrade.Net.Client.OpenAPIDateConverter;

namespace SnapTrade.Net.Model
{
    /// <summary>
    /// OptionChainInner
    /// </summary>
    [DataContract(Name = "OptionChain_inner")]
    public partial class OptionChainInner : IEquatable<OptionChainInner>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="OptionChainInner" /> class.
        /// </summary>
        /// <param name="expiryDate">expiryDate.</param>
        /// <param name="description">description.</param>
        /// <param name="listingExchange">listingExchange.</param>
        /// <param name="optionExerciseType">optionExerciseType.</param>
        /// <param name="chainPerRoot">chainPerRoot.</param>
        public OptionChainInner(string expiryDate = default(string), string description = default(string), string listingExchange = default(string), string optionExerciseType = default(string), List<OptionChainInnerChainPerRootInner> chainPerRoot = default(List<OptionChainInnerChainPerRootInner>)) : base()
        {
            this.ExpiryDate = expiryDate;
            this.Description = description;
            this.ListingExchange = listingExchange;
            this.OptionExerciseType = optionExerciseType;
            this.ChainPerRoot = chainPerRoot;
            this.AdditionalProperties = new Dictionary<string, object>();
        }

        /// <summary>
        /// Gets or Sets ExpiryDate
        /// </summary>
        [DataMember(Name = "expiryDate", EmitDefaultValue = false)]
        public string ExpiryDate { get; set; }

        /// <summary>
        /// Gets or Sets Description
        /// </summary>
        [DataMember(Name = "description", EmitDefaultValue = false)]
        public string Description { get; set; }

        /// <summary>
        /// Gets or Sets ListingExchange
        /// </summary>
        [DataMember(Name = "listingExchange", EmitDefaultValue = false)]
        public string ListingExchange { get; set; }

        /// <summary>
        /// Gets or Sets OptionExerciseType
        /// </summary>
        [DataMember(Name = "optionExerciseType", EmitDefaultValue = false)]
        public string OptionExerciseType { get; set; }

        /// <summary>
        /// Gets or Sets ChainPerRoot
        /// </summary>
        [DataMember(Name = "chainPerRoot", EmitDefaultValue = false)]
        public List<OptionChainInnerChainPerRootInner> ChainPerRoot { get; set; }

        /// <summary>
        /// Gets or Sets additional properties
        /// </summary>
        [JsonExtensionData]
        public IDictionary<string, object> AdditionalProperties { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class OptionChainInner {\n");
            sb.Append("  ").Append(base.ToString().Replace("\n", "\n  ")).Append("\n");
            sb.Append("  ExpiryDate: ").Append(ExpiryDate).Append("\n");
            sb.Append("  Description: ").Append(Description).Append("\n");
            sb.Append("  ListingExchange: ").Append(ListingExchange).Append("\n");
            sb.Append("  OptionExerciseType: ").Append(OptionExerciseType).Append("\n");
            sb.Append("  ChainPerRoot: ").Append(ChainPerRoot).Append("\n");
            sb.Append("  AdditionalProperties: ").Append(AdditionalProperties).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 string ToJson()
        {
            return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.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 OptionChainInner);
        }

        /// <summary>
        /// Returns true if OptionChainInner instances are equal
        /// </summary>
        /// <param name="input">Instance of OptionChainInner to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OptionChainInner input)
        {
            if (input == null)
            {
                return false;
            }
            return base.Equals(input) && 
                (
                    this.ExpiryDate == input.ExpiryDate ||
                    (this.ExpiryDate != null &&
                    this.ExpiryDate.Equals(input.ExpiryDate))
                ) && base.Equals(input) && 
                (
                    this.Description == input.Description ||
                    (this.Description != null &&
                    this.Description.Equals(input.Description))
                ) && base.Equals(input) && 
                (
                    this.ListingExchange == input.ListingExchange ||
                    (this.ListingExchange != null &&
                    this.ListingExchange.Equals(input.ListingExchange))
                ) && base.Equals(input) && 
                (
                    this.OptionExerciseType == input.OptionExerciseType ||
                    (this.OptionExerciseType != null &&
                    this.OptionExerciseType.Equals(input.OptionExerciseType))
                ) && base.Equals(input) && 
                (
                    this.ChainPerRoot == input.ChainPerRoot ||
                    this.ChainPerRoot != null &&
                    input.ChainPerRoot != null &&
                    this.ChainPerRoot.SequenceEqual(input.ChainPerRoot)
                )
                && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any());
        }

        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = base.GetHashCode();
                if (this.ExpiryDate != null)
                {
                    hashCode = (hashCode * 59) + this.ExpiryDate.GetHashCode();
                }
                if (this.Description != null)
                {
                    hashCode = (hashCode * 59) + this.Description.GetHashCode();
                }
                if (this.ListingExchange != null)
                {
                    hashCode = (hashCode * 59) + this.ListingExchange.GetHashCode();
                }
                if (this.OptionExerciseType != null)
                {
                    hashCode = (hashCode * 59) + this.OptionExerciseType.GetHashCode();
                }
                if (this.ChainPerRoot != null)
                {
                    hashCode = (hashCode * 59) + this.ChainPerRoot.GetHashCode();
                }
                if (this.AdditionalProperties != null)
                {
                    hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
                }
                return hashCode;
            }
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext)
        {
            yield break;
        }
    }

}
