namespace Betfair.Gamex.API.Entities
{
    /// <summary>
    /// Account snapshot helper
    /// </summary>
    public partial class accountSnapshot
    {
        /// <summary>
        /// Amount available to bet
        /// </summary>
        public double availableToBetBalance
        {
            get
            {
                if (this.Items.Length == 5)
                {
                    return (double)this.Items[0];
                }

                return 0;
            }
        }

        /// <summary>
        /// Amount available to transfer out
        /// </summary>
        public double availableToTransferOut
        {
            get
            {
                if (this.Items.Length == 5)
                {
                    return (double)this.Items[1];
                }

                return 0;
            }
        }

        /// <summary>
        /// Betfair games overall balance
        /// </summary>
        public double betfairGamesBalance
        {
            get
            {
                if (this.Items.Length == 5)
                {
                    return (double)this.Items[2];
                }

                return 0;
            }
        }

        /// <summary>
        /// Amount currently exposed
        /// </summary>
        public double currentExposure
        {
            get
            {
                if (this.Items.Length == 5)
                {
                    return (double)this.Items[3];
                }

                return 0;
            }
        }

        /// <summary>
        /// Amount of retained commission
        /// </summary>
        public double retainedCommission
        {
            get
            {
                if (this.Items.Length == 5)
                {
                    return (double)this.Items[4];
                }

                return 0;
            }
        }
    }

    /// <summary>
    /// Selection snapshot helper
    /// </summary>
    public partial class selectionSnapshot
    {
        /// <summary>
        /// Profit and loss on selection for any winner market
        /// </summary>
        public selectionSnapshotProfitAndLoss ProfitAndLoss
        {
            get
            {
                if (this.Item is selectionSnapshotProfitAndLoss)
                {
                    return this.Item as selectionSnapshotProfitAndLoss;
                }

                return null;
            }
        }

        /// <summary>
        /// Profit and loss for single winner market
        /// </summary>
        public decimal ProfitLoss
        {
            get
            {
                if (this.Item is decimal)
                {
                    return (decimal)this.Item;
                }

                return 0;
            }
        }
    }

    /// <summary>
    /// Account statement item helper
    /// </summary>
    public partial class accountStatementItemAccountStatementDescription
    {
        /// <summary>
        /// Account statement bet description
        /// </summary>
        public accountStatementBetDescription accountStatementBetDescription
        {
            get
            {
                if (this.Item is accountStatementBetDescription)
                {
                    return this.Item as accountStatementBetDescription;
                }

                return null;
            }
        }

        /// <summary>
        /// Account statement commission description
        /// </summary>
        public accountStatementCommissionDescription accountStatementCommissionDescription
        {
            get
            {
                if (this.Item is accountStatementCommissionDescription)
                {
                    return this.Item as accountStatementCommissionDescription;
                }

                return null;
            }
        }

        /// <summary>
        /// Account statement game state description
        /// </summary>
        public accountStatementGameStateDescription accountStatementGameStateDescription
        {
            get
            {
                if (this.Item is accountStatementGameStateDescription)
                {
                    return this.Item as accountStatementGameStateDescription;
                }

                return null;
            }
        }

        /// <summary>
        /// Account statement transfer description
        /// </summary>
        public accountStatementTransferDescription accountStatementTransferDescription
        {
            get
            {
                if (this.Item is accountStatementTransferDescription)
                {
                    return this.Item as accountStatementTransferDescription;
                }

                return null;
            }
        }
    }
}