/*
 * SnapTrade
 *
 * Connect brokerage accounts to your app for live positions and trading
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: ychag@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>
    /// OptionStrategyLegsInner
    /// </summary>
    [DataContract(Name = "OptionStrategy_legs_inner")]
    public partial class OptionStrategyLegsInner : IEquatable<OptionStrategyLegsInner>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="OptionStrategyLegsInner" /> class.
        /// </summary>
        /// <param name="optionSymbolId">optionSymbolId.</param>
        /// <param name="index">index.</param>
        /// <param name="action">action.</param>
        /// <param name="quantity">quantity.</param>
        public OptionStrategyLegsInner(string optionSymbolId = default(string), decimal index = default(decimal), string action = default(string), decimal quantity = default(decimal))
        {
            this.OptionSymbolId = optionSymbolId;
            this.Index = index;
            this.Action = action;
            this.Quantity = quantity;
        }

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

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

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

        /// <summary>
        /// Gets or Sets Quantity
        /// </summary>
        [DataMember(Name = "quantity", EmitDefaultValue = false)]
        public decimal Quantity { 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 OptionStrategyLegsInner {\n");
            sb.Append("  OptionSymbolId: ").Append(OptionSymbolId).Append("\n");
            sb.Append("  Index: ").Append(Index).Append("\n");
            sb.Append("  Action: ").Append(Action).Append("\n");
            sb.Append("  Quantity: ").Append(Quantity).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 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 OptionStrategyLegsInner);
        }

        /// <summary>
        /// Returns true if OptionStrategyLegsInner instances are equal
        /// </summary>
        /// <param name="input">Instance of OptionStrategyLegsInner to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OptionStrategyLegsInner input)
        {
            if (input == null)
            {
                return false;
            }
            return 
                (
                    this.OptionSymbolId == input.OptionSymbolId ||
                    (this.OptionSymbolId != null &&
                    this.OptionSymbolId.Equals(input.OptionSymbolId))
                ) && 
                (
                    this.Index == input.Index ||
                    this.Index.Equals(input.Index)
                ) && 
                (
                    this.Action == input.Action ||
                    (this.Action != null &&
                    this.Action.Equals(input.Action))
                ) && 
                (
                    this.Quantity == input.Quantity ||
                    this.Quantity.Equals(input.Quantity)
                );
        }

        /// <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.OptionSymbolId != null)
                {
                    hashCode = (hashCode * 59) + this.OptionSymbolId.GetHashCode();
                }
                hashCode = (hashCode * 59) + this.Index.GetHashCode();
                if (this.Action != null)
                {
                    hashCode = (hashCode * 59) + this.Action.GetHashCode();
                }
                hashCode = (hashCode * 59) + this.Quantity.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;
        }
    }

}
