/*
 * SnapTrade
 *
 * Connect brokerage accounts to your app for live positions and trading
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: envkt@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>
    /// OptionsGetOptionStrategyRequest
    /// </summary>
    [DataContract(Name = "Options_getOptionStrategy_request")]
    public partial class OptionsGetOptionStrategyRequest : IEquatable<OptionsGetOptionStrategyRequest>, IValidatableObject
    {
        /// <summary>
        /// Defines StrategyType
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public enum StrategyTypeEnum
        {
            /// <summary>
            /// Enum CUSTOM for value: CUSTOM
            /// </summary>
            [EnumMember(Value = "CUSTOM")]
            CUSTOM = 1

        }


        /// <summary>
        /// Gets or Sets StrategyType
        /// </summary>
        [DataMember(Name = "strategy_type", IsRequired = true, EmitDefaultValue = true)]
        public StrategyTypeEnum StrategyType { get; set; }
        /// <summary>
        /// Initializes a new instance of the <see cref="OptionsGetOptionStrategyRequest" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected OptionsGetOptionStrategyRequest() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="OptionsGetOptionStrategyRequest" /> class.
        /// </summary>
        /// <param name="underlyingSymbolId">underlyingSymbolId (required).</param>
        /// <param name="legs">legs (required).</param>
        /// <param name="strategyType">strategyType (required).</param>
        public OptionsGetOptionStrategyRequest(Guid underlyingSymbolId = default(Guid), List<OptionLeg> legs = default(List<OptionLeg>), StrategyTypeEnum strategyType = default(StrategyTypeEnum))
        {
            this.UnderlyingSymbolId = underlyingSymbolId;
            // to ensure "legs" is required (not null)
            if (legs == null)
            {
                throw new ArgumentNullException("legs is a required property for OptionsGetOptionStrategyRequest and cannot be null");
            }
            this.Legs = legs;
            this.StrategyType = strategyType;
        }

        /// <summary>
        /// Gets or Sets UnderlyingSymbolId
        /// </summary>
        [DataMember(Name = "underlying_symbol_id", IsRequired = true, EmitDefaultValue = true)]
        public Guid UnderlyingSymbolId { get; set; }

        /// <summary>
        /// Gets or Sets Legs
        /// </summary>
        [DataMember(Name = "legs", IsRequired = true, EmitDefaultValue = true)]
        public List<OptionLeg> Legs { 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 OptionsGetOptionStrategyRequest {\n");
            sb.Append("  UnderlyingSymbolId: ").Append(UnderlyingSymbolId).Append("\n");
            sb.Append("  Legs: ").Append(Legs).Append("\n");
            sb.Append("  StrategyType: ").Append(StrategyType).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 OptionsGetOptionStrategyRequest);
        }

        /// <summary>
        /// Returns true if OptionsGetOptionStrategyRequest instances are equal
        /// </summary>
        /// <param name="input">Instance of OptionsGetOptionStrategyRequest to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OptionsGetOptionStrategyRequest input)
        {
            if (input == null)
            {
                return false;
            }
            return 
                (
                    this.UnderlyingSymbolId == input.UnderlyingSymbolId ||
                    (this.UnderlyingSymbolId != null &&
                    this.UnderlyingSymbolId.Equals(input.UnderlyingSymbolId))
                ) && 
                (
                    this.Legs == input.Legs ||
                    this.Legs != null &&
                    input.Legs != null &&
                    this.Legs.SequenceEqual(input.Legs)
                ) && 
                (
                    this.StrategyType == input.StrategyType ||
                    this.StrategyType.Equals(input.StrategyType)
                );
        }

        /// <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.UnderlyingSymbolId != null)
                {
                    hashCode = (hashCode * 59) + this.UnderlyingSymbolId.GetHashCode();
                }
                if (this.Legs != null)
                {
                    hashCode = (hashCode * 59) + this.Legs.GetHashCode();
                }
                hashCode = (hashCode * 59) + this.StrategyType.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;
        }
    }

}
