# 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
from pydantic import BaseModel, Field, StrictStr, validator

class ChargebackUpdateRequest(BaseModel):
    """
    ChargebackUpdateRequest
    """
    reason_description: Optional[StrictStr] = Field(None, description="Either 'reason_description' or 'reason_code' is required")
    reason_code: Optional[StrictStr] = Field(None, description="Either 'reason_code' or 'reason_description' is required")
    __properties = ["reason_description", "reason_code"]

    @validator('reason_description')
    def reason_description_validate_enum(cls, v):
        if v is None:
            return v

        if v not in ('SERVICE_NOT_PROVIDED_MERCHANDISE_NOT_RECEIVED', 'CANCELLED_RECURRING_TRANSACTION', 'NOT_AS_DESCRIBED_OR_DEFECTIVE_MERCHANDISE', 'FRAUD_MULTIPLE_TRANSACTIONS', 'FRAUD_TRANSACTION', 'NO_AUTHORIZATION', 'LATE_PRESENTMENT', 'TRANSACTION_NOT_RECOGNIZED', 'INCORRECT_CURRENCY', 'INCORRECT_TRANSACTION_CODE', 'INCORRECT_CURRENCY_OR_TRANSACTION_CODE', 'INCORRECT_TRANSACTION_AMOUNT', 'INCORRECT_ACCOUNT_NUMBER', 'INCORRECT_TRANSACTION_AMOUNT_OR_ACCOUNT_NUMBER', 'NOT_AUTHORIZED_CARD_PRESENT', 'NOT_AUTHORIZED_CARD_ABSENT', 'CREDIT_NOT_PROCESSED', 'NON_RECEIPT_OF_CASH_OR_LOAD_TRANSACTION_VALUE_AT_ATM', 'DUPLICATE_PROCESSING_OR_PAID_BY_OTHER_MEANS'):
            raise ValueError("must be one of enum values ('SERVICE_NOT_PROVIDED_MERCHANDISE_NOT_RECEIVED', 'CANCELLED_RECURRING_TRANSACTION', 'NOT_AS_DESCRIBED_OR_DEFECTIVE_MERCHANDISE', 'FRAUD_MULTIPLE_TRANSACTIONS', 'FRAUD_TRANSACTION', 'NO_AUTHORIZATION', 'LATE_PRESENTMENT', 'TRANSACTION_NOT_RECOGNIZED', 'INCORRECT_CURRENCY', 'INCORRECT_TRANSACTION_CODE', 'INCORRECT_CURRENCY_OR_TRANSACTION_CODE', 'INCORRECT_TRANSACTION_AMOUNT', 'INCORRECT_ACCOUNT_NUMBER', 'INCORRECT_TRANSACTION_AMOUNT_OR_ACCOUNT_NUMBER', 'NOT_AUTHORIZED_CARD_PRESENT', 'NOT_AUTHORIZED_CARD_ABSENT', 'CREDIT_NOT_PROCESSED', 'NON_RECEIPT_OF_CASH_OR_LOAD_TRANSACTION_VALUE_AT_ATM', 'DUPLICATE_PROCESSING_OR_PAID_BY_OTHER_MEANS')")
        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) -> ChargebackUpdateRequest:
        """Create an instance of ChargebackUpdateRequest 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) -> ChargebackUpdateRequest:
        """Create an instance of ChargebackUpdateRequest from a dict"""
        if obj is None:
            return None

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

        _obj = ChargebackUpdateRequest.parse_obj({
            "reason_description": obj.get("reason_description"),
            "reason_code": obj.get("reason_code")
        })
        return _obj

