# 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 datetime import datetime
from typing import Optional, Union
from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, constr, validator

class ChargebackTransitionResponse(BaseModel):
    """
    ChargebackTransitionResponse
    """
    token: constr(strict=True, max_length=36, min_length=0) = ...
    state: StrictStr = ...
    previous_state: StrictStr = ...
    channel: StrictStr = ...
    chargeback_token: constr(strict=True, max_length=36, min_length=1) = ...
    reason: Optional[constr(strict=True, max_length=1024, min_length=0)] = None
    transaction_token: Optional[constr(strict=True, max_length=36, min_length=0)] = None
    created_time: datetime = Field(..., description="yyyy-MM-ddTHH:mm:ssZ")
    last_modified_time: datetime = Field(..., description="yyyy-MM-ddTHH:mm:ssZ")
    type: StrictStr = ...
    amount: Optional[Union[StrictFloat, StrictInt]] = None
    __properties = ["token", "state", "previous_state", "channel", "chargeback_token", "reason", "transaction_token", "created_time", "last_modified_time", "type", "amount"]

    @validator('state')
    def state_validate_enum(cls, v):
        if v not in ('INITIATED', 'REPRESENTMENT', 'PREARBITRATION', 'ARBITRATION', 'CASE_WON', 'CASE_LOST', 'NETWORK_REJECTED', 'WITHDRAWN', 'WRITTEN_OFF_ISSUER', 'WRITTEN_OFF_PROGRAM'):
            raise ValueError("must be one of enum values ('INITIATED', 'REPRESENTMENT', 'PREARBITRATION', 'ARBITRATION', 'CASE_WON', 'CASE_LOST', 'NETWORK_REJECTED', 'WITHDRAWN', 'WRITTEN_OFF_ISSUER', 'WRITTEN_OFF_PROGRAM')")
        return v

    @validator('previous_state')
    def previous_state_validate_enum(cls, v):
        if v not in ('INITIATED', 'REPRESENTMENT', 'PREARBITRATION', 'ARBITRATION', 'CASE_WON', 'CASE_LOST', 'NETWORK_REJECTED', 'WITHDRAWN'):
            raise ValueError("must be one of enum values ('INITIATED', 'REPRESENTMENT', 'PREARBITRATION', 'ARBITRATION', 'CASE_WON', 'CASE_LOST', 'NETWORK_REJECTED', 'WITHDRAWN')")
        return v

    @validator('channel')
    def channel_validate_enum(cls, v):
        if v not in ('GATEWAY', 'GATEWAY_AUTOMATED', 'ISSUER', 'ISSUER_AUTOMATED'):
            raise ValueError("must be one of enum values ('GATEWAY', 'GATEWAY_AUTOMATED', 'ISSUER', 'ISSUER_AUTOMATED')")
        return v

    @validator('type')
    def type_validate_enum(cls, v):
        if v not in ('initiated', 'representment', 'prearbitration', 'arbitration', 'case.won', 'case.lost', 'network.rejected', 'written.off.issuer', 'written.off.program'):
            raise ValueError("must be one of enum values ('initiated', 'representment', 'prearbitration', 'arbitration', 'case.won', 'case.lost', 'network.rejected', 'written.off.issuer', 'written.off.program')")
        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) -> ChargebackTransitionResponse:
        """Create an instance of ChargebackTransitionResponse 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) -> ChargebackTransitionResponse:
        """Create an instance of ChargebackTransitionResponse from a dict"""
        if obj is None:
            return None

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

        _obj = ChargebackTransitionResponse.parse_obj({
            "token": obj.get("token"),
            "state": obj.get("state"),
            "previous_state": obj.get("previous_state"),
            "channel": obj.get("channel"),
            "chargeback_token": obj.get("chargeback_token"),
            "reason": obj.get("reason"),
            "transaction_token": obj.get("transaction_token"),
            "created_time": obj.get("created_time"),
            "last_modified_time": obj.get("last_modified_time"),
            "type": obj.get("type"),
            "amount": obj.get("amount")
        })
        return _obj

