# coding: utf-8

"""
    TrueLayer Resource API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)  # noqa: E501

    The version of the OpenAPI document: v1.0
    Contact: rienafairefr@gmail.com
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

import marshmallow
from marshmallow import Schema, validates, ValidationError, post_load, missing

from truelayer import fields
from truelayer.configuration import Configuration



class TransactionSchema(Schema):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """
    amount = marshmallow.fields.Float()

    balance = fields.Nested('Balance')('BalanceSchema', )

    currency = marshmallow.fields.String()

    description = marshmallow.fields.String()

    meta = marshmallow.fields.Dict(keys=marshmallow.fields.String(), values=marshmallow.fields.String()
,)

    timestamp = fields.DateTime()

    transaction_id = marshmallow.fields.String()

    transaction_type = marshmallow.fields.String()

    @validates("amount")
    def validates_amount(self, amount):
        pass

    @validates("balance")
    def validates_balance(self, balance):
        pass

    @validates("currency")
    def validates_currency(self, currency):
        pass

    @validates("description")
    def validates_description(self, description):
        pass

    @validates("meta")
    def validates_meta(self, meta):
        pass

    @validates("timestamp")
    def validates_timestamp(self, timestamp):
        pass

    @validates("transaction_id")
    def validates_transaction_id(self, transaction_id):
        pass

    @validates("transaction_type")
    def validates_transaction_type(self, transaction_type):
        pass

    @post_load
    def post_load(self, data, **kwargs):
        config = Configuration()
        config.client_side_validation = False
        return Transaction(local_vars_configuration=config, **data)


class Transaction(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    """
    Attributes:
      openapi_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.
    """
    openapi_types = {
        'amount': 'float',
        'balance': 'Balance',
        'currency': 'str',
        'description': 'str',
        'meta': 'dict(str, str)',
        'timestamp': 'datetime',
        'transaction_id': 'str',
        'transaction_type': 'str'
    }

    attribute_map = {
        'amount': 'amount',
        'balance': 'balance',
        'currency': 'currency',
        'description': 'description',
        'meta': 'meta',
        'timestamp': 'timestamp',
        'transaction_id': 'transaction_id',
        'transaction_type': 'transaction_type'
    }

    def __init__(self, amount=missing, balance=missing, currency=missing, description=missing, meta=missing, timestamp=missing, transaction_id=missing, transaction_type=missing, local_vars_configuration=None):  # noqa: E501
        """Transaction - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self.discriminator = None
        if self.local_vars_configuration.client_side_validation:
            validated = TransactionSchema().load({
                'amount': amount,
                'balance': balance,
                'currency': currency,
                'description': description,
                'meta': meta,
                'timestamp': timestamp,
                'transaction_id': transaction_id,
                'transaction_type': transaction_type
            })
            self.amount = validated.amount
            self.balance = validated.balance
            self.currency = validated.currency
            self.description = validated.description
            self.meta = validated.meta
            self.timestamp = validated.timestamp
            self.transaction_id = validated.transaction_id
            self.transaction_type = validated.transaction_type
        else:
            self.amount = amount
            self.balance = balance
            self.currency = currency
            self.description = description
            self.meta = meta
            self.timestamp = timestamp
            self.transaction_id = transaction_id
            self.transaction_type = transaction_type

    def to_dict(self):
        """Returns the model properties as a dict"""
        return TransactionSchema().dump(self)

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

        return self.to_dict() == other.to_dict()

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

        return self.to_dict() != other.to_dict()
