# coding: utf-8

"""
    OANDA v20 REST API

    The full OANDA v20 REST API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more. To authenticate use the string 'Bearer ' followed by the token which can be obtained at https://www.oanda.com/demo-account/tpa/personal_token  # noqa: E501

    OpenAPI spec version: 3.0.23
    Contact: api@oanda.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


import pprint
import re  # noqa: F401

import six

from oanda.models.calculated_position_state import CalculatedPositionState  # noqa: F401,E501
from oanda.models.calculated_trade_state import CalculatedTradeState  # noqa: F401,E501
from oanda.models.dynamic_order_state import DynamicOrderState  # noqa: F401,E501


class AccountChangesState(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    """

    """
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    swagger_types = {
        'unrealized_pl': 'str',
        'nav': 'str',
        'margin_used': 'str',
        'margin_available': 'str',
        'position_value': 'str',
        'margin_closeout_unrealized_pl': 'str',
        'margin_closeout_nav': 'str',
        'margin_closeout_margin_used': 'str',
        'margin_closeout_percent': 'str',
        'margin_closeout_position_value': 'str',
        'withdrawal_limit': 'str',
        'margin_call_margin_used': 'str',
        'margin_call_percent': 'str',
        'orders': 'list[DynamicOrderState]',
        'trades': 'list[CalculatedTradeState]',
        'positions': 'list[CalculatedPositionState]'
    }

    attribute_map = {
        'unrealized_pl': 'unrealizedPL',
        'nav': 'NAV',
        'margin_used': 'marginUsed',
        'margin_available': 'marginAvailable',
        'position_value': 'positionValue',
        'margin_closeout_unrealized_pl': 'marginCloseoutUnrealizedPL',
        'margin_closeout_nav': 'marginCloseoutNAV',
        'margin_closeout_margin_used': 'marginCloseoutMarginUsed',
        'margin_closeout_percent': 'marginCloseoutPercent',
        'margin_closeout_position_value': 'marginCloseoutPositionValue',
        'withdrawal_limit': 'withdrawalLimit',
        'margin_call_margin_used': 'marginCallMarginUsed',
        'margin_call_percent': 'marginCallPercent',
        'orders': 'orders',
        'trades': 'trades',
        'positions': 'positions'
    }

    def __init__(self, unrealized_pl=None, nav=None, margin_used=None, margin_available=None, position_value=None, margin_closeout_unrealized_pl=None, margin_closeout_nav=None, margin_closeout_margin_used=None, margin_closeout_percent=None, margin_closeout_position_value=None, withdrawal_limit=None, margin_call_margin_used=None, margin_call_percent=None, orders=None, trades=None, positions=None):  # noqa: E501
        """AccountChangesState - a model defined in Swagger"""  # noqa: E501

        self._unrealized_pl = None
        self._nav = None
        self._margin_used = None
        self._margin_available = None
        self._position_value = None
        self._margin_closeout_unrealized_pl = None
        self._margin_closeout_nav = None
        self._margin_closeout_margin_used = None
        self._margin_closeout_percent = None
        self._margin_closeout_position_value = None
        self._withdrawal_limit = None
        self._margin_call_margin_used = None
        self._margin_call_percent = None
        self._orders = None
        self._trades = None
        self._positions = None
        self.discriminator = None

        if unrealized_pl is not None:
            self.unrealized_pl = unrealized_pl
        if nav is not None:
            self.nav = nav
        if margin_used is not None:
            self.margin_used = margin_used
        if margin_available is not None:
            self.margin_available = margin_available
        if position_value is not None:
            self.position_value = position_value
        if margin_closeout_unrealized_pl is not None:
            self.margin_closeout_unrealized_pl = margin_closeout_unrealized_pl
        if margin_closeout_nav is not None:
            self.margin_closeout_nav = margin_closeout_nav
        if margin_closeout_margin_used is not None:
            self.margin_closeout_margin_used = margin_closeout_margin_used
        if margin_closeout_percent is not None:
            self.margin_closeout_percent = margin_closeout_percent
        if margin_closeout_position_value is not None:
            self.margin_closeout_position_value = margin_closeout_position_value
        if withdrawal_limit is not None:
            self.withdrawal_limit = withdrawal_limit
        if margin_call_margin_used is not None:
            self.margin_call_margin_used = margin_call_margin_used
        if margin_call_percent is not None:
            self.margin_call_percent = margin_call_percent
        if orders is not None:
            self.orders = orders
        if trades is not None:
            self.trades = trades
        if positions is not None:
            self.positions = positions

    @property
    def unrealized_pl(self):
        """Gets the unrealized_pl of this AccountChangesState.  # noqa: E501

        The total unrealized profit/loss for all Trades currently open in the Account.  # noqa: E501

        :return: The unrealized_pl of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._unrealized_pl

    @unrealized_pl.setter
    def unrealized_pl(self, unrealized_pl):
        """Sets the unrealized_pl of this AccountChangesState.

        The total unrealized profit/loss for all Trades currently open in the Account.  # noqa: E501

        :param unrealized_pl: The unrealized_pl of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._unrealized_pl = unrealized_pl

    @property
    def nav(self):
        """Gets the nav of this AccountChangesState.  # noqa: E501

        The net asset value of the Account. Equal to Account balance + unrealizedPL.  # noqa: E501

        :return: The nav of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._nav

    @nav.setter
    def nav(self, nav):
        """Sets the nav of this AccountChangesState.

        The net asset value of the Account. Equal to Account balance + unrealizedPL.  # noqa: E501

        :param nav: The nav of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._nav = nav

    @property
    def margin_used(self):
        """Gets the margin_used of this AccountChangesState.  # noqa: E501

        Margin currently used for the Account.  # noqa: E501

        :return: The margin_used of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._margin_used

    @margin_used.setter
    def margin_used(self, margin_used):
        """Sets the margin_used of this AccountChangesState.

        Margin currently used for the Account.  # noqa: E501

        :param margin_used: The margin_used of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._margin_used = margin_used

    @property
    def margin_available(self):
        """Gets the margin_available of this AccountChangesState.  # noqa: E501

        Margin available for Account currency.  # noqa: E501

        :return: The margin_available of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._margin_available

    @margin_available.setter
    def margin_available(self, margin_available):
        """Sets the margin_available of this AccountChangesState.

        Margin available for Account currency.  # noqa: E501

        :param margin_available: The margin_available of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._margin_available = margin_available

    @property
    def position_value(self):
        """Gets the position_value of this AccountChangesState.  # noqa: E501

        The value of the Account's open positions represented in the Account's home currency.  # noqa: E501

        :return: The position_value of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._position_value

    @position_value.setter
    def position_value(self, position_value):
        """Sets the position_value of this AccountChangesState.

        The value of the Account's open positions represented in the Account's home currency.  # noqa: E501

        :param position_value: The position_value of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._position_value = position_value

    @property
    def margin_closeout_unrealized_pl(self):
        """Gets the margin_closeout_unrealized_pl of this AccountChangesState.  # noqa: E501

        The Account's margin closeout unrealized PL.  # noqa: E501

        :return: The margin_closeout_unrealized_pl of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._margin_closeout_unrealized_pl

    @margin_closeout_unrealized_pl.setter
    def margin_closeout_unrealized_pl(self, margin_closeout_unrealized_pl):
        """Sets the margin_closeout_unrealized_pl of this AccountChangesState.

        The Account's margin closeout unrealized PL.  # noqa: E501

        :param margin_closeout_unrealized_pl: The margin_closeout_unrealized_pl of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._margin_closeout_unrealized_pl = margin_closeout_unrealized_pl

    @property
    def margin_closeout_nav(self):
        """Gets the margin_closeout_nav of this AccountChangesState.  # noqa: E501

        The Account's margin closeout NAV.  # noqa: E501

        :return: The margin_closeout_nav of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._margin_closeout_nav

    @margin_closeout_nav.setter
    def margin_closeout_nav(self, margin_closeout_nav):
        """Sets the margin_closeout_nav of this AccountChangesState.

        The Account's margin closeout NAV.  # noqa: E501

        :param margin_closeout_nav: The margin_closeout_nav of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._margin_closeout_nav = margin_closeout_nav

    @property
    def margin_closeout_margin_used(self):
        """Gets the margin_closeout_margin_used of this AccountChangesState.  # noqa: E501

        The Account's margin closeout margin used.  # noqa: E501

        :return: The margin_closeout_margin_used of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._margin_closeout_margin_used

    @margin_closeout_margin_used.setter
    def margin_closeout_margin_used(self, margin_closeout_margin_used):
        """Sets the margin_closeout_margin_used of this AccountChangesState.

        The Account's margin closeout margin used.  # noqa: E501

        :param margin_closeout_margin_used: The margin_closeout_margin_used of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._margin_closeout_margin_used = margin_closeout_margin_used

    @property
    def margin_closeout_percent(self):
        """Gets the margin_closeout_percent of this AccountChangesState.  # noqa: E501

        The Account's margin closeout percentage. When this value is 1.0 or above the Account is in a margin closeout situation.  # noqa: E501

        :return: The margin_closeout_percent of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._margin_closeout_percent

    @margin_closeout_percent.setter
    def margin_closeout_percent(self, margin_closeout_percent):
        """Sets the margin_closeout_percent of this AccountChangesState.

        The Account's margin closeout percentage. When this value is 1.0 or above the Account is in a margin closeout situation.  # noqa: E501

        :param margin_closeout_percent: The margin_closeout_percent of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._margin_closeout_percent = margin_closeout_percent

    @property
    def margin_closeout_position_value(self):
        """Gets the margin_closeout_position_value of this AccountChangesState.  # noqa: E501

        The value of the Account's open positions as used for margin closeout calculations represented in the Account's home currency.  # noqa: E501

        :return: The margin_closeout_position_value of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._margin_closeout_position_value

    @margin_closeout_position_value.setter
    def margin_closeout_position_value(self, margin_closeout_position_value):
        """Sets the margin_closeout_position_value of this AccountChangesState.

        The value of the Account's open positions as used for margin closeout calculations represented in the Account's home currency.  # noqa: E501

        :param margin_closeout_position_value: The margin_closeout_position_value of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._margin_closeout_position_value = margin_closeout_position_value

    @property
    def withdrawal_limit(self):
        """Gets the withdrawal_limit of this AccountChangesState.  # noqa: E501

        The current WithdrawalLimit for the account which will be zero or a positive value indicating how much can be withdrawn from the account.  # noqa: E501

        :return: The withdrawal_limit of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._withdrawal_limit

    @withdrawal_limit.setter
    def withdrawal_limit(self, withdrawal_limit):
        """Sets the withdrawal_limit of this AccountChangesState.

        The current WithdrawalLimit for the account which will be zero or a positive value indicating how much can be withdrawn from the account.  # noqa: E501

        :param withdrawal_limit: The withdrawal_limit of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._withdrawal_limit = withdrawal_limit

    @property
    def margin_call_margin_used(self):
        """Gets the margin_call_margin_used of this AccountChangesState.  # noqa: E501

        The Account's margin call margin used.  # noqa: E501

        :return: The margin_call_margin_used of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._margin_call_margin_used

    @margin_call_margin_used.setter
    def margin_call_margin_used(self, margin_call_margin_used):
        """Sets the margin_call_margin_used of this AccountChangesState.

        The Account's margin call margin used.  # noqa: E501

        :param margin_call_margin_used: The margin_call_margin_used of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._margin_call_margin_used = margin_call_margin_used

    @property
    def margin_call_percent(self):
        """Gets the margin_call_percent of this AccountChangesState.  # noqa: E501

        The Account's margin call percentage. When this value is 1.0 or above the Account is in a margin call situation.  # noqa: E501

        :return: The margin_call_percent of this AccountChangesState.  # noqa: E501
        :rtype: str
        """
        return self._margin_call_percent

    @margin_call_percent.setter
    def margin_call_percent(self, margin_call_percent):
        """Sets the margin_call_percent of this AccountChangesState.

        The Account's margin call percentage. When this value is 1.0 or above the Account is in a margin call situation.  # noqa: E501

        :param margin_call_percent: The margin_call_percent of this AccountChangesState.  # noqa: E501
        :type: str
        """

        self._margin_call_percent = margin_call_percent

    @property
    def orders(self):
        """Gets the orders of this AccountChangesState.  # noqa: E501

        The price-dependent state of each pending Order in the Account.  # noqa: E501

        :return: The orders of this AccountChangesState.  # noqa: E501
        :rtype: list[DynamicOrderState]
        """
        return self._orders

    @orders.setter
    def orders(self, orders):
        """Sets the orders of this AccountChangesState.

        The price-dependent state of each pending Order in the Account.  # noqa: E501

        :param orders: The orders of this AccountChangesState.  # noqa: E501
        :type: list[DynamicOrderState]
        """

        self._orders = orders

    @property
    def trades(self):
        """Gets the trades of this AccountChangesState.  # noqa: E501

        The price-dependent state for each open Trade in the Account.  # noqa: E501

        :return: The trades of this AccountChangesState.  # noqa: E501
        :rtype: list[CalculatedTradeState]
        """
        return self._trades

    @trades.setter
    def trades(self, trades):
        """Sets the trades of this AccountChangesState.

        The price-dependent state for each open Trade in the Account.  # noqa: E501

        :param trades: The trades of this AccountChangesState.  # noqa: E501
        :type: list[CalculatedTradeState]
        """

        self._trades = trades

    @property
    def positions(self):
        """Gets the positions of this AccountChangesState.  # noqa: E501

        The price-dependent state for each open Position in the Account.  # noqa: E501

        :return: The positions of this AccountChangesState.  # noqa: E501
        :rtype: list[CalculatedPositionState]
        """
        return self._positions

    @positions.setter
    def positions(self, positions):
        """Sets the positions of this AccountChangesState.

        The price-dependent state for each open Position in the Account.  # noqa: E501

        :param positions: The positions of this AccountChangesState.  # noqa: E501
        :type: list[CalculatedPositionState]
        """

        self._positions = positions

    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self.to_dict())

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, AccountChangesState):
            return False

        return self.__dict__ == other.__dict__

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        return not self == other
