# 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.client_extensions import ClientExtensions  # noqa: F401,E501


class TradeOpen(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 = {
        'trade_id': 'str',
        'units': 'str',
        'price': 'str',
        'guaranteed_execution_fee': 'str',
        'client_extensions': 'ClientExtensions',
        'half_spread_cost': 'str',
        'initial_margin_required': 'str'
    }

    attribute_map = {
        'trade_id': 'tradeID',
        'units': 'units',
        'price': 'price',
        'guaranteed_execution_fee': 'guaranteedExecutionFee',
        'client_extensions': 'clientExtensions',
        'half_spread_cost': 'halfSpreadCost',
        'initial_margin_required': 'initialMarginRequired'
    }

    def __init__(self, trade_id=None, units=None, price=None, guaranteed_execution_fee=None, client_extensions=None, half_spread_cost=None, initial_margin_required=None):  # noqa: E501
        """TradeOpen - a model defined in Swagger"""  # noqa: E501

        self._trade_id = None
        self._units = None
        self._price = None
        self._guaranteed_execution_fee = None
        self._client_extensions = None
        self._half_spread_cost = None
        self._initial_margin_required = None
        self.discriminator = None

        if trade_id is not None:
            self.trade_id = trade_id
        if units is not None:
            self.units = units
        if price is not None:
            self.price = price
        if guaranteed_execution_fee is not None:
            self.guaranteed_execution_fee = guaranteed_execution_fee
        if client_extensions is not None:
            self.client_extensions = client_extensions
        if half_spread_cost is not None:
            self.half_spread_cost = half_spread_cost
        if initial_margin_required is not None:
            self.initial_margin_required = initial_margin_required

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

        The ID of the Trade that was opened  # noqa: E501

        :return: The trade_id of this TradeOpen.  # noqa: E501
        :rtype: str
        """
        return self._trade_id

    @trade_id.setter
    def trade_id(self, trade_id):
        """Sets the trade_id of this TradeOpen.

        The ID of the Trade that was opened  # noqa: E501

        :param trade_id: The trade_id of this TradeOpen.  # noqa: E501
        :type: str
        """

        self._trade_id = trade_id

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

        The number of units opened by the Trade  # noqa: E501

        :return: The units of this TradeOpen.  # noqa: E501
        :rtype: str
        """
        return self._units

    @units.setter
    def units(self, units):
        """Sets the units of this TradeOpen.

        The number of units opened by the Trade  # noqa: E501

        :param units: The units of this TradeOpen.  # noqa: E501
        :type: str
        """

        self._units = units

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

        The average price that the units were opened at.  # noqa: E501

        :return: The price of this TradeOpen.  # noqa: E501
        :rtype: str
        """
        return self._price

    @price.setter
    def price(self, price):
        """Sets the price of this TradeOpen.

        The average price that the units were opened at.  # noqa: E501

        :param price: The price of this TradeOpen.  # noqa: E501
        :type: str
        """

        self._price = price

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

        This is the fee charged for opening the trade if it has a guaranteed Stop Loss Order attached to it.  # noqa: E501

        :return: The guaranteed_execution_fee of this TradeOpen.  # noqa: E501
        :rtype: str
        """
        return self._guaranteed_execution_fee

    @guaranteed_execution_fee.setter
    def guaranteed_execution_fee(self, guaranteed_execution_fee):
        """Sets the guaranteed_execution_fee of this TradeOpen.

        This is the fee charged for opening the trade if it has a guaranteed Stop Loss Order attached to it.  # noqa: E501

        :param guaranteed_execution_fee: The guaranteed_execution_fee of this TradeOpen.  # noqa: E501
        :type: str
        """

        self._guaranteed_execution_fee = guaranteed_execution_fee

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


        :return: The client_extensions of this TradeOpen.  # noqa: E501
        :rtype: ClientExtensions
        """
        return self._client_extensions

    @client_extensions.setter
    def client_extensions(self, client_extensions):
        """Sets the client_extensions of this TradeOpen.


        :param client_extensions: The client_extensions of this TradeOpen.  # noqa: E501
        :type: ClientExtensions
        """

        self._client_extensions = client_extensions

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

        The half spread cost for the trade open. This can be a positive or negative value and is represented in the home currency of the Account.  # noqa: E501

        :return: The half_spread_cost of this TradeOpen.  # noqa: E501
        :rtype: str
        """
        return self._half_spread_cost

    @half_spread_cost.setter
    def half_spread_cost(self, half_spread_cost):
        """Sets the half_spread_cost of this TradeOpen.

        The half spread cost for the trade open. This can be a positive or negative value and is represented in the home currency of the Account.  # noqa: E501

        :param half_spread_cost: The half_spread_cost of this TradeOpen.  # noqa: E501
        :type: str
        """

        self._half_spread_cost = half_spread_cost

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

        The margin required at the time the Trade was created. Note, this is the 'pure' margin required, it is not the 'effective' margin used that factors in the trade risk if a GSLO is attached to the trade.  # noqa: E501

        :return: The initial_margin_required of this TradeOpen.  # noqa: E501
        :rtype: str
        """
        return self._initial_margin_required

    @initial_margin_required.setter
    def initial_margin_required(self, initial_margin_required):
        """Sets the initial_margin_required of this TradeOpen.

        The margin required at the time the Trade was created. Note, this is the 'pure' margin required, it is not the 'effective' margin used that factors in the trade risk if a GSLO is attached to the trade.  # noqa: E501

        :param initial_margin_required: The initial_margin_required of this TradeOpen.  # noqa: E501
        :type: str
        """

        self._initial_margin_required = initial_margin_required

    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, TradeOpen):
            return False

        return self.__dict__ == other.__dict__

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