# 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.price_bucket import PriceBucket  # noqa: F401,E501
from oanda.models.quote_home_conversion_factors import QuoteHomeConversionFactors  # noqa: F401,E501
from oanda.models.units_available import UnitsAvailable  # noqa: F401,E501


class Price(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 = {
        'type': 'str',
        'instrument': 'str',
        'time': 'str',
        'status': 'str',
        'tradeable': 'bool',
        'bids': 'list[PriceBucket]',
        'asks': 'list[PriceBucket]',
        'closeout_bid': 'str',
        'closeout_ask': 'str',
        'quote_home_conversion_factors': 'QuoteHomeConversionFactors',
        'units_available': 'UnitsAvailable'
    }

    attribute_map = {
        'type': 'type',
        'instrument': 'instrument',
        'time': 'time',
        'status': 'status',
        'tradeable': 'tradeable',
        'bids': 'bids',
        'asks': 'asks',
        'closeout_bid': 'closeoutBid',
        'closeout_ask': 'closeoutAsk',
        'quote_home_conversion_factors': 'quoteHomeConversionFactors',
        'units_available': 'unitsAvailable'
    }

    def __init__(self, type=None, instrument=None, time=None, status=None, tradeable=None, bids=None, asks=None, closeout_bid=None, closeout_ask=None, quote_home_conversion_factors=None, units_available=None):  # noqa: E501
        """Price - a model defined in Swagger"""  # noqa: E501

        self._type = None
        self._instrument = None
        self._time = None
        self._status = None
        self._tradeable = None
        self._bids = None
        self._asks = None
        self._closeout_bid = None
        self._closeout_ask = None
        self._quote_home_conversion_factors = None
        self._units_available = None
        self.discriminator = None

        if type is not None:
            self.type = type
        if instrument is not None:
            self.instrument = instrument
        if time is not None:
            self.time = time
        if status is not None:
            self.status = status
        if tradeable is not None:
            self.tradeable = tradeable
        if bids is not None:
            self.bids = bids
        if asks is not None:
            self.asks = asks
        if closeout_bid is not None:
            self.closeout_bid = closeout_bid
        if closeout_ask is not None:
            self.closeout_ask = closeout_ask
        if quote_home_conversion_factors is not None:
            self.quote_home_conversion_factors = quote_home_conversion_factors
        if units_available is not None:
            self.units_available = units_available

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

        The string \"PRICE\". Used to identify the a Price object when found in a stream.  # noqa: E501

        :return: The type of this Price.  # noqa: E501
        :rtype: str
        """
        return self._type

    @type.setter
    def type(self, type):
        """Sets the type of this Price.

        The string \"PRICE\". Used to identify the a Price object when found in a stream.  # noqa: E501

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

        self._type = type

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

        The Price's Instrument.  # noqa: E501

        :return: The instrument of this Price.  # noqa: E501
        :rtype: str
        """
        return self._instrument

    @instrument.setter
    def instrument(self, instrument):
        """Sets the instrument of this Price.

        The Price's Instrument.  # noqa: E501

        :param instrument: The instrument of this Price.  # noqa: E501
        :type: str
        """

        self._instrument = instrument

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

        The date/time when the Price was created  # noqa: E501

        :return: The time of this Price.  # noqa: E501
        :rtype: str
        """
        return self._time

    @time.setter
    def time(self, time):
        """Sets the time of this Price.

        The date/time when the Price was created  # noqa: E501

        :param time: The time of this Price.  # noqa: E501
        :type: str
        """

        self._time = time

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

        The status of the Price.  # noqa: E501

        :return: The status of this Price.  # noqa: E501
        :rtype: str
        """
        return self._status

    @status.setter
    def status(self, status):
        """Sets the status of this Price.

        The status of the Price.  # noqa: E501

        :param status: The status of this Price.  # noqa: E501
        :type: str
        """
        allowed_values = ["tradeable", "non-tradeable", "invalid"]  # noqa: E501
        if status not in allowed_values:
            raise ValueError(
                "Invalid value for `status` ({0}), must be one of {1}"  # noqa: E501
                .format(status, allowed_values)
            )

        self._status = status

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

        Flag indicating if the Price is tradeable or not  # noqa: E501

        :return: The tradeable of this Price.  # noqa: E501
        :rtype: bool
        """
        return self._tradeable

    @tradeable.setter
    def tradeable(self, tradeable):
        """Sets the tradeable of this Price.

        Flag indicating if the Price is tradeable or not  # noqa: E501

        :param tradeable: The tradeable of this Price.  # noqa: E501
        :type: bool
        """

        self._tradeable = tradeable

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

        The list of prices and liquidity available on the Instrument's bid side. It is possible for this list to be empty if there is no bid liquidity currently available for the Instrument in the Account.  # noqa: E501

        :return: The bids of this Price.  # noqa: E501
        :rtype: list[PriceBucket]
        """
        return self._bids

    @bids.setter
    def bids(self, bids):
        """Sets the bids of this Price.

        The list of prices and liquidity available on the Instrument's bid side. It is possible for this list to be empty if there is no bid liquidity currently available for the Instrument in the Account.  # noqa: E501

        :param bids: The bids of this Price.  # noqa: E501
        :type: list[PriceBucket]
        """

        self._bids = bids

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

        The list of prices and liquidity available on the Instrument's ask side. It is possible for this list to be empty if there is no ask liquidity currently available for the Instrument in the Account.  # noqa: E501

        :return: The asks of this Price.  # noqa: E501
        :rtype: list[PriceBucket]
        """
        return self._asks

    @asks.setter
    def asks(self, asks):
        """Sets the asks of this Price.

        The list of prices and liquidity available on the Instrument's ask side. It is possible for this list to be empty if there is no ask liquidity currently available for the Instrument in the Account.  # noqa: E501

        :param asks: The asks of this Price.  # noqa: E501
        :type: list[PriceBucket]
        """

        self._asks = asks

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

        The closeout bid Price. This Price is used when a bid is required to closeout a Position (margin closeout or manual) yet there is no bid liquidity. The closeout bid is never used to open a new position.  # noqa: E501

        :return: The closeout_bid of this Price.  # noqa: E501
        :rtype: str
        """
        return self._closeout_bid

    @closeout_bid.setter
    def closeout_bid(self, closeout_bid):
        """Sets the closeout_bid of this Price.

        The closeout bid Price. This Price is used when a bid is required to closeout a Position (margin closeout or manual) yet there is no bid liquidity. The closeout bid is never used to open a new position.  # noqa: E501

        :param closeout_bid: The closeout_bid of this Price.  # noqa: E501
        :type: str
        """

        self._closeout_bid = closeout_bid

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

        The closeout ask Price. This Price is used when a ask is required to closeout a Position (margin closeout or manual) yet there is no ask liquidity. The closeout ask is never used to open a new position.  # noqa: E501

        :return: The closeout_ask of this Price.  # noqa: E501
        :rtype: str
        """
        return self._closeout_ask

    @closeout_ask.setter
    def closeout_ask(self, closeout_ask):
        """Sets the closeout_ask of this Price.

        The closeout ask Price. This Price is used when a ask is required to closeout a Position (margin closeout or manual) yet there is no ask liquidity. The closeout ask is never used to open a new position.  # noqa: E501

        :param closeout_ask: The closeout_ask of this Price.  # noqa: E501
        :type: str
        """

        self._closeout_ask = closeout_ask

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


        :return: The quote_home_conversion_factors of this Price.  # noqa: E501
        :rtype: QuoteHomeConversionFactors
        """
        return self._quote_home_conversion_factors

    @quote_home_conversion_factors.setter
    def quote_home_conversion_factors(self, quote_home_conversion_factors):
        """Sets the quote_home_conversion_factors of this Price.


        :param quote_home_conversion_factors: The quote_home_conversion_factors of this Price.  # noqa: E501
        :type: QuoteHomeConversionFactors
        """

        self._quote_home_conversion_factors = quote_home_conversion_factors

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


        :return: The units_available of this Price.  # noqa: E501
        :rtype: UnitsAvailable
        """
        return self._units_available

    @units_available.setter
    def units_available(self, units_available):
        """Sets the units_available of this Price.


        :param units_available: The units_available of this Price.  # noqa: E501
        :type: UnitsAvailable
        """

        self._units_available = units_available

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

        return self.__dict__ == other.__dict__

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