# 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 Any, Dict, List, Optional
from pydantic import BaseModel, StrictInt, StrictStr, conlist, validator
from marqeta_client.models.internal_authorization_transaction import InternalAuthorizationTransaction

class InternalFindOriginalRequest(BaseModel):
    """
    InternalFindOriginalRequest
    """
    authorization_tranlog: InternalAuthorizationTransaction = ...
    override_days: Optional[StrictInt] = None
    context: Optional[Dict[str, Dict[str, Any]]] = None
    configuration: Optional[Dict[str, StrictStr]] = None
    finders: Optional[conlist(StrictStr)] = None
    original_timestamp: Optional[datetime] = None
    original_stan: Optional[StrictStr] = None
    __properties = ["authorization_tranlog", "override_days", "context", "configuration", "finders", "original_timestamp", "original_stan"]

    @validator('finders')
    def finders_validate_enum(cls, v):
        if v is None:
            return v

        for i in v:
            if i not in ('AMOUNT_LOCAL_TXN_DATE', 'APPROVAL_CODE_RRN', 'APPROVAL_CODE_STAN', 'APPROVAL_CODE_STAN_LOCAL_TXN_DATE', 'APPROVAL_CODE_CARDHOLDER_AMOUNT', 'CHARGEBACK_NREF_', 'EXPIRABLE_AUTH_DIGEST', 'LOCAL_TXN_DATE_MID_AMOUNT', 'LOCAL_TXN_DATE_MID_AMOUNT_TIP', 'MOD_LOCAL_TXN_DATE_MID_AMOUNT_TIP', 'MOST_RECENT_CHARGEBACK_TXN', 'NRID_EXCEPT_PULSE', 'NRID', 'NULL_RESULT', 'PULSE_STAN_RRN', 'RRN_EXCEPT_PULSE', 'RRN', 'TXN_TOKEN'):
                raise ValueError("each list item must be one of ('AMOUNT_LOCAL_TXN_DATE', 'APPROVAL_CODE_RRN', 'APPROVAL_CODE_STAN', 'APPROVAL_CODE_STAN_LOCAL_TXN_DATE', 'APPROVAL_CODE_CARDHOLDER_AMOUNT', 'CHARGEBACK_NREF_', 'EXPIRABLE_AUTH_DIGEST', 'LOCAL_TXN_DATE_MID_AMOUNT', 'LOCAL_TXN_DATE_MID_AMOUNT_TIP', 'MOD_LOCAL_TXN_DATE_MID_AMOUNT_TIP', 'MOST_RECENT_CHARGEBACK_TXN', 'NRID_EXCEPT_PULSE', 'NRID', 'NULL_RESULT', 'PULSE_STAN_RRN', 'RRN_EXCEPT_PULSE', 'RRN', 'TXN_TOKEN')")
        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) -> InternalFindOriginalRequest:
        """Create an instance of InternalFindOriginalRequest 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 authorization_tranlog
        if self.authorization_tranlog:
            _dict['authorization_tranlog'] = self.authorization_tranlog.to_dict()
        return _dict

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

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

        _obj = InternalFindOriginalRequest.parse_obj({
            "authorization_tranlog": InternalAuthorizationTransaction.from_dict(obj.get("authorization_tranlog")) if obj.get("authorization_tranlog") is not None else None,
            "override_days": obj.get("override_days"),
            "context": obj.get("context"),
            "configuration": obj.get("configuration"),
            "finders": obj.get("finders"),
            "original_timestamp": obj.get("original_timestamp"),
            "original_stan": obj.get("original_stan")
        })
        return _obj

