# coding: utf-8

"""
    Conekta API

    Conekta sdk  # noqa: E501

    The version of the OpenAPI document: 2.1.0
    Contact: engineering@conekta.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


from __future__ import annotations
import pprint
import re  # noqa: F401
import json


from typing import Optional
from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, constr
from conekta.models.transfer_destination_response import TransferDestinationResponse

class TransferResponse(BaseModel):
    """
    A transfer represents the action of sending an amount to a business bank account including the status, amount and method used to make the transfer.
    """
    amount: Optional[StrictInt] = Field(None, description="Amount in cents of the transfer.")
    created_at: Optional[StrictInt] = Field(None, description="Date and time of creation of the transfer in Unix format.")
    currency: Optional[constr(strict=True, max_length=3)] = Field(None, description="The currency of the transfer. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)")
    id: Optional[StrictStr] = Field(None, description="Unique identifier of the transfer.")
    livemode: Optional[StrictBool] = Field(None, description="Indicates whether the transfer was created in live mode or test mode.")
    destination: Optional[TransferDestinationResponse] = None
    object: Optional[StrictStr] = Field(None, description="Object name, which is transfer.")
    statement_description: Optional[StrictStr] = Field(None, description="Description of the transfer.")
    statement_reference: Optional[StrictStr] = Field(None, description="Reference number of the transfer.")
    status: Optional[StrictStr] = Field(None, description="Code indicating transfer status.")
    __properties = ["amount", "created_at", "currency", "id", "livemode", "destination", "object", "statement_description", "statement_reference", "status"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> TransferResponse:
        """Create an instance of TransferResponse from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        # override the default output from pydantic by calling `to_dict()` of destination
        if self.destination:
            _dict['destination'] = self.destination.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> TransferResponse:
        """Create an instance of TransferResponse from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return TransferResponse.parse_obj(obj)

        _obj = TransferResponse.parse_obj({
            "amount": obj.get("amount"),
            "created_at": obj.get("created_at"),
            "currency": obj.get("currency"),
            "id": obj.get("id"),
            "livemode": obj.get("livemode"),
            "destination": TransferDestinationResponse.from_dict(obj.get("destination")) if obj.get("destination") is not None else None,
            "object": obj.get("object"),
            "statement_description": obj.get("statement_description"),
            "statement_reference": obj.get("statement_reference"),
            "status": obj.get("status")
        })
        return _obj

