/*
 * 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>
    /// SnapTradeUser Investment Account
    /// </summary>
    [DataContract(Name = "Account")]
    public partial class Account : IEquatable<Account>, IValidatableObject
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Account" /> class.
        /// </summary>
        /// <param name="id">id.</param>
        /// <param name="brokerageAuthorization">brokerageAuthorization.</param>
        /// <param name="portfolioGroup">portfolioGroup.</param>
        /// <param name="name">name.</param>
        /// <param name="number">number.</param>
        /// <param name="institutionName">institutionName.</param>
        /// <param name="createdDate">createdDate.</param>
        /// <param name="meta">meta.</param>
        /// <param name="cashRestrictions">cashRestrictions.</param>
        /// <param name="syncStatus">syncStatus.</param>
        public Account(Guid id = default(Guid), Guid brokerageAuthorization = default(Guid), Guid portfolioGroup = default(Guid), string name = default(string), string number = default(string), string institutionName = default(string), string createdDate = default(string), Dictionary<string, Object> meta = default(Dictionary<string, Object>), List<CashRestriction> cashRestrictions = default(List<CashRestriction>), AccountSyncStatus syncStatus = default(AccountSyncStatus)) : base()
        {
            this.Id = id;
            this.BrokerageAuthorization = brokerageAuthorization;
            this.PortfolioGroup = portfolioGroup;
            this.Name = name;
            this.Number = number;
            this.InstitutionName = institutionName;
            this.CreatedDate = createdDate;
            this.Meta = meta;
            this.CashRestrictions = cashRestrictions;
            this.SyncStatus = syncStatus;
            this.AdditionalProperties = new Dictionary<string, object>();
        }

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

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

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

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

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

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

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

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

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

        /// <summary>
        /// Gets or Sets SyncStatus
        /// </summary>
        [DataMember(Name = "sync_status", EmitDefaultValue = false)]
        public AccountSyncStatus SyncStatus { 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 Account {\n");
            sb.Append("  ").Append(base.ToString().Replace("\n", "\n  ")).Append("\n");
            sb.Append("  Id: ").Append(Id).Append("\n");
            sb.Append("  BrokerageAuthorization: ").Append(BrokerageAuthorization).Append("\n");
            sb.Append("  PortfolioGroup: ").Append(PortfolioGroup).Append("\n");
            sb.Append("  Name: ").Append(Name).Append("\n");
            sb.Append("  Number: ").Append(Number).Append("\n");
            sb.Append("  InstitutionName: ").Append(InstitutionName).Append("\n");
            sb.Append("  CreatedDate: ").Append(CreatedDate).Append("\n");
            sb.Append("  Meta: ").Append(Meta).Append("\n");
            sb.Append("  CashRestrictions: ").Append(CashRestrictions).Append("\n");
            sb.Append("  SyncStatus: ").Append(SyncStatus).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 Account);
        }

        /// <summary>
        /// Returns true if Account instances are equal
        /// </summary>
        /// <param name="input">Instance of Account to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Account input)
        {
            if (input == null)
            {
                return false;
            }
            return base.Equals(input) && 
                (
                    this.Id == input.Id ||
                    (this.Id != null &&
                    this.Id.Equals(input.Id))
                ) && base.Equals(input) && 
                (
                    this.BrokerageAuthorization == input.BrokerageAuthorization ||
                    (this.BrokerageAuthorization != null &&
                    this.BrokerageAuthorization.Equals(input.BrokerageAuthorization))
                ) && base.Equals(input) && 
                (
                    this.PortfolioGroup == input.PortfolioGroup ||
                    (this.PortfolioGroup != null &&
                    this.PortfolioGroup.Equals(input.PortfolioGroup))
                ) && base.Equals(input) && 
                (
                    this.Name == input.Name ||
                    (this.Name != null &&
                    this.Name.Equals(input.Name))
                ) && base.Equals(input) && 
                (
                    this.Number == input.Number ||
                    (this.Number != null &&
                    this.Number.Equals(input.Number))
                ) && base.Equals(input) && 
                (
                    this.InstitutionName == input.InstitutionName ||
                    (this.InstitutionName != null &&
                    this.InstitutionName.Equals(input.InstitutionName))
                ) && base.Equals(input) && 
                (
                    this.CreatedDate == input.CreatedDate ||
                    (this.CreatedDate != null &&
                    this.CreatedDate.Equals(input.CreatedDate))
                ) && base.Equals(input) && 
                (
                    this.Meta == input.Meta ||
                    this.Meta != null &&
                    input.Meta != null &&
                    this.Meta.SequenceEqual(input.Meta)
                ) && base.Equals(input) && 
                (
                    this.CashRestrictions == input.CashRestrictions ||
                    this.CashRestrictions != null &&
                    input.CashRestrictions != null &&
                    this.CashRestrictions.SequenceEqual(input.CashRestrictions)
                ) && base.Equals(input) && 
                (
                    this.SyncStatus == input.SyncStatus ||
                    (this.SyncStatus != null &&
                    this.SyncStatus.Equals(input.SyncStatus))
                )
                && (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.Id != null)
                {
                    hashCode = (hashCode * 59) + this.Id.GetHashCode();
                }
                if (this.BrokerageAuthorization != null)
                {
                    hashCode = (hashCode * 59) + this.BrokerageAuthorization.GetHashCode();
                }
                if (this.PortfolioGroup != null)
                {
                    hashCode = (hashCode * 59) + this.PortfolioGroup.GetHashCode();
                }
                if (this.Name != null)
                {
                    hashCode = (hashCode * 59) + this.Name.GetHashCode();
                }
                if (this.Number != null)
                {
                    hashCode = (hashCode * 59) + this.Number.GetHashCode();
                }
                if (this.InstitutionName != null)
                {
                    hashCode = (hashCode * 59) + this.InstitutionName.GetHashCode();
                }
                if (this.CreatedDate != null)
                {
                    hashCode = (hashCode * 59) + this.CreatedDate.GetHashCode();
                }
                if (this.Meta != null)
                {
                    hashCode = (hashCode * 59) + this.Meta.GetHashCode();
                }
                if (this.CashRestrictions != null)
                {
                    hashCode = (hashCode * 59) + this.CashRestrictions.GetHashCode();
                }
                if (this.SyncStatus != null)
                {
                    hashCode = (hashCode * 59) + this.SyncStatus.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;
        }
    }

}
