# coding: utf-8

"""
    Marqeta Core API

    Simplified management of your payment programs  # noqa: E501

    The version of the OpenAPI document: 3.0.0
    Contact: dev@swadesh.co
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


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


from typing import Optional, Union
from pydantic import BaseModel, Field, StrictStr, confloat, conint, constr, validator

class BankTransferRequestModel(BaseModel):
    """
    BankTransferRequestModel
    """
    token: Optional[constr(strict=True, max_length=36, min_length=0)] = None
    amount: Union[confloat(ge=0.01, strict=True), conint(ge=1, strict=True)] = ...
    memo: Optional[StrictStr] = None
    channel: Optional[StrictStr] = Field(None, description="default = API")
    funding_source_token: constr(strict=True, max_length=36, min_length=0) = ...
    type: StrictStr = ...
    statement_descriptor: Optional[constr(strict=True, max_length=10, min_length=0)] = None
    currency_code: Optional[StrictStr] = Field(None, description="default = USD")
    transfer_speed: Optional[StrictStr] = Field(None, description="default = STANDARD")
    standard_entry_class_code: Optional[StrictStr] = None
    created_by: Optional[constr(strict=True, max_length=255, min_length=0)] = None
    __properties = ["token", "amount", "memo", "channel", "funding_source_token", "type", "statement_descriptor", "currency_code", "transfer_speed", "standard_entry_class_code", "created_by"]

    @validator('channel')
    def channel_validate_enum(cls, v):
        if v is None:
            return v

        if v not in ('API', 'SYSTEM', 'ADMIN'):
            raise ValueError("must be one of enum values ('API', 'SYSTEM', 'ADMIN')")
        return v

    @validator('type')
    def type_validate_enum(cls, v):
        if v not in ('PUSH', 'PULL'):
            raise ValueError("must be one of enum values ('PUSH', 'PULL')")
        return v

    @validator('transfer_speed')
    def transfer_speed_validate_enum(cls, v):
        if v is None:
            return v

        if v not in ('STANDARD', 'SAME_DAY'):
            raise ValueError("must be one of enum values ('STANDARD', 'SAME_DAY')")
        return v

    @validator('standard_entry_class_code')
    def standard_entry_class_code_validate_enum(cls, v):
        if v is None:
            return v

        if v not in ('WEB', 'PPD', 'CCD'):
            raise ValueError("must be one of enum values ('WEB', 'PPD', 'CCD')")
        return v

    class Config:
        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) -> BankTransferRequestModel:
        """Create an instance of BankTransferRequestModel 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)
        return _dict

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

        if type(obj) is not dict:
            return BankTransferRequestModel.parse_obj(obj)

        _obj = BankTransferRequestModel.parse_obj({
            "token": obj.get("token"),
            "amount": obj.get("amount"),
            "memo": obj.get("memo"),
            "channel": obj.get("channel"),
            "funding_source_token": obj.get("funding_source_token"),
            "type": obj.get("type"),
            "statement_descriptor": obj.get("statement_descriptor"),
            "currency_code": obj.get("currency_code"),
            "transfer_speed": obj.get("transfer_speed"),
            "standard_entry_class_code": obj.get("standard_entry_class_code"),
            "created_by": obj.get("created_by")
        })
        return _obj

