# 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, StrictFloat, StrictInt, StrictStr, validator
from marqeta_client.models.address_verification_model import AddressVerificationModel
from marqeta_client.models.transaction_card_acceptor_view_model_v1 import TransactionCardAcceptorViewModelV1

class FraudStreamRequest(BaseModel):
    """
    FraudStreamRequest
    """
    program: Optional[StrictStr] = None
    type: Optional[StrictStr] = None
    state: Optional[StrictStr] = None
    itc: Optional[StrictStr] = None
    token: Optional[StrictStr] = None
    user_token: Optional[StrictStr] = None
    acting_user_token: Optional[StrictStr] = None
    card_token: Optional[StrictStr] = None
    user_transaction_time: Optional[datetime] = None
    request_amount: Optional[Union[StrictFloat, StrictInt]] = None
    amount: Optional[Union[StrictFloat, StrictInt]] = None
    currency_code: Optional[StrictStr] = None
    network: Optional[StrictStr] = None
    account_risk_score: Optional[StrictStr] = None
    account_risk_score_reason_code: Optional[StrictStr] = None
    transaction_risk_score: Optional[StrictInt] = None
    transaction_risk_score_reason_code: Optional[StrictStr] = None
    card_acceptor: Optional[TransactionCardAcceptorViewModelV1] = None
    address_verification: Optional[AddressVerificationModel] = None
    __properties = ["program", "type", "state", "itc", "token", "user_token", "acting_user_token", "card_token", "user_transaction_time", "request_amount", "amount", "currency_code", "network", "account_risk_score", "account_risk_score_reason_code", "transaction_risk_score", "transaction_risk_score_reason_code", "card_acceptor", "address_verification"]

    @validator('type')
    def type_validate_enum(cls, v):
        if v is None:
            return v

        if v not in ('gpa.credit.pending', 'gpa.credit.pending.reversal', 'gpa.credit.reversal', 'gpa.credit', 'gpa.debit', 'gpa.debit.pending', 'gpa.debit.pending.reversal', 'gpa.debit.reversal', 'gpa.grant', 'gpa.credit.networkload', 'gpa.credit.networkload.clearing', 'gpa.credit.networkload.reversal', 'gpa.debit.networkload', 'gpa.debit.networkload.clearing', 'gpa.debit.networkload.reversal', 'original.credit.authorization', 'original.credit.authorization.clearing', 'original.credit.authorization.reversal', 'original.credit.auth_plus_capture', 'original.credit.auth_plus_capture.reversal', 'gpa.credit.issueroperator', 'gpa.debit.issueroperator', 'gpa.debit.authorization', 'gpa.credit.authorization', 'gpa.credit.authorization.reversal', 'gpa.credit.chargeback', 'gpa.credit.chargeback.reversal', 'gpa.credit.billpayment', 'gpa.credit.authorization.billpayment', 'gpa.credit.authorization.billpayment.reversal', 'msa.credit.pending', 'msa.credit.pending.reversal', 'msa.credit.reversal', 'msa.credit', 'msa.debit.reversal', 'msa.debit.pending.reversal', 'msa.debit', 'msa.credit.authorization', 'msa.credit.authorization.reversal', 'msa.credit.chargeback', 'msa.credit.chargeback.reversal', 'authorization', 'authorization.incremental', 'authorization.advice', 'authorization.reversal', 'authorization.cashback', 'authorization.quasi.cash', 'authorization.atm.withdrawal', 'authorization.clearing', 'authorization.clearing.network.fee', 'authorization.clearing.representment', 'authorization.reversal.issuerexpiration', 'dispute.credit', 'dispute.debit', 'chargeback.pfs.debit', 'chargeback.pfs.pending.debit', 'chargeback.pfs.credit', 'authorization.clearing.chargeback', 'authorization.clearing.chargeback.reversal', 'authorization.clearing.chargeback.completed', 'authorization.clearing.chargeback.provisional.credit', 'authorization.clearing.chargeback.provisional.debit', 'authorization.clearing.chargeback.writeoff', 'authorization.clearing.cashback', 'authorization.clearing.quasi.cash', 'authorization.clearing.atm.withdrawal', 'account.funding.authorization', 'account.funding.authorization.clearing', 'account.funding.auth_plus_capture', 'account.funding.authorization.reversal', 'account.funding.auth_plus_capture.reversal', 'address.verification', 'balanceinquiry', 'refund', 'pindebit.credit.adjustment', 'pindebit.debit.adjustment', 'pindebit.atm.withdrawal', 'pindebit.quasi.cash', 'pindebit.balanceinquiry', 'pindebit.cashback', 'pindebit.checkavs', 'pindebit.financial.deposit', 'pindebit.refund', 'pindebit.reversal', 'pindebit.refund.reversal', 'pindebit.transfer', 'pindebit', 'pindebit.representment', 'pindebit.authorization', 'pindebit.authorization.clearing', 'pindebit.authorization.reversal', 'pindebit.authorization.reversal.issuerexpiration', 'pindebit.chargeback', 'pindebit.chargeback.reversal', 'pindebit.chargeback.completed', 'pindebit.chargeback.provisional.credit', 'pindebit.chargeback.provisional.debit', 'pindebit.chargeback.writeoff', 'directdeposit.credit', 'directdeposit.debit', 'directdeposit.credit.pending', 'directdeposit.debit.pending', 'directdeposit.credit.reject', 'directdeposit.debit.reject', 'directdeposit.credit.pending.reversal', 'directdeposit.debit.pending.reversal', 'directdeposit.credit.reversal', 'directdeposit.debit.reversal', 'fee.charge.pending', 'fee.charge', 'fee.charge.pending.refund', 'funds.expire', 'programreserve.credit', 'programreserve.debit', 'reward.earn', 'transfer.peer', 'transfer.fee', 'account.credit', 'account.debit', 'transfer.program', 'token.activation-request', 'token.advice', 'pushtocard.debit', 'pushtocard.pending', 'pushtocard.reversal', 'billpayment', 'billpayment.clearing', 'billpayment.reversal', 'refund.authorization', 'refund.authorization.clearing', 'refund.authorization.reversal', 'ach.early.funds', 'ach.early.funds.reversed', 'ach.push.pending', 'ach.pull.pending', 'ach.push', 'ach.pull', 'ach.cancel', 'ach.returned', 'ach.pull.returned', 'ach.push.returned', 'ach.provisional.credit', 'ach.provisional.credit.reversed', 'ach.push.reversal.completed', 'ach.push.reversal.declined', 'ach.jit.push.pending', 'ach.jit.pull.pending', 'ach.jit.push', 'ach.jit.pull', 'ach.jit.cancel', 'ach.jit.pull.returned', 'ach.jit.push.returned', 'check.return.debit', 'check.return.debit.reversal', 'check.clearing.debit', 'accountfunding.pull', 'accountfunding.pull.chargeback', 'escheatment.debit', 'escheatment.debit.reversal', 'escheatment.debit.clearing', 'zero.clearing', 'credit.adjustment', 'debit.adjustment', 'account.transfer', 'account.transfer.reversal', 'unknown'):
            raise ValueError("must be one of enum values ('gpa.credit.pending', 'gpa.credit.pending.reversal', 'gpa.credit.reversal', 'gpa.credit', 'gpa.debit', 'gpa.debit.pending', 'gpa.debit.pending.reversal', 'gpa.debit.reversal', 'gpa.grant', 'gpa.credit.networkload', 'gpa.credit.networkload.clearing', 'gpa.credit.networkload.reversal', 'gpa.debit.networkload', 'gpa.debit.networkload.clearing', 'gpa.debit.networkload.reversal', 'original.credit.authorization', 'original.credit.authorization.clearing', 'original.credit.authorization.reversal', 'original.credit.auth_plus_capture', 'original.credit.auth_plus_capture.reversal', 'gpa.credit.issueroperator', 'gpa.debit.issueroperator', 'gpa.debit.authorization', 'gpa.credit.authorization', 'gpa.credit.authorization.reversal', 'gpa.credit.chargeback', 'gpa.credit.chargeback.reversal', 'gpa.credit.billpayment', 'gpa.credit.authorization.billpayment', 'gpa.credit.authorization.billpayment.reversal', 'msa.credit.pending', 'msa.credit.pending.reversal', 'msa.credit.reversal', 'msa.credit', 'msa.debit.reversal', 'msa.debit.pending.reversal', 'msa.debit', 'msa.credit.authorization', 'msa.credit.authorization.reversal', 'msa.credit.chargeback', 'msa.credit.chargeback.reversal', 'authorization', 'authorization.incremental', 'authorization.advice', 'authorization.reversal', 'authorization.cashback', 'authorization.quasi.cash', 'authorization.atm.withdrawal', 'authorization.clearing', 'authorization.clearing.network.fee', 'authorization.clearing.representment', 'authorization.reversal.issuerexpiration', 'dispute.credit', 'dispute.debit', 'chargeback.pfs.debit', 'chargeback.pfs.pending.debit', 'chargeback.pfs.credit', 'authorization.clearing.chargeback', 'authorization.clearing.chargeback.reversal', 'authorization.clearing.chargeback.completed', 'authorization.clearing.chargeback.provisional.credit', 'authorization.clearing.chargeback.provisional.debit', 'authorization.clearing.chargeback.writeoff', 'authorization.clearing.cashback', 'authorization.clearing.quasi.cash', 'authorization.clearing.atm.withdrawal', 'account.funding.authorization', 'account.funding.authorization.clearing', 'account.funding.auth_plus_capture', 'account.funding.authorization.reversal', 'account.funding.auth_plus_capture.reversal', 'address.verification', 'balanceinquiry', 'refund', 'pindebit.credit.adjustment', 'pindebit.debit.adjustment', 'pindebit.atm.withdrawal', 'pindebit.quasi.cash', 'pindebit.balanceinquiry', 'pindebit.cashback', 'pindebit.checkavs', 'pindebit.financial.deposit', 'pindebit.refund', 'pindebit.reversal', 'pindebit.refund.reversal', 'pindebit.transfer', 'pindebit', 'pindebit.representment', 'pindebit.authorization', 'pindebit.authorization.clearing', 'pindebit.authorization.reversal', 'pindebit.authorization.reversal.issuerexpiration', 'pindebit.chargeback', 'pindebit.chargeback.reversal', 'pindebit.chargeback.completed', 'pindebit.chargeback.provisional.credit', 'pindebit.chargeback.provisional.debit', 'pindebit.chargeback.writeoff', 'directdeposit.credit', 'directdeposit.debit', 'directdeposit.credit.pending', 'directdeposit.debit.pending', 'directdeposit.credit.reject', 'directdeposit.debit.reject', 'directdeposit.credit.pending.reversal', 'directdeposit.debit.pending.reversal', 'directdeposit.credit.reversal', 'directdeposit.debit.reversal', 'fee.charge.pending', 'fee.charge', 'fee.charge.pending.refund', 'funds.expire', 'programreserve.credit', 'programreserve.debit', 'reward.earn', 'transfer.peer', 'transfer.fee', 'account.credit', 'account.debit', 'transfer.program', 'token.activation-request', 'token.advice', 'pushtocard.debit', 'pushtocard.pending', 'pushtocard.reversal', 'billpayment', 'billpayment.clearing', 'billpayment.reversal', 'refund.authorization', 'refund.authorization.clearing', 'refund.authorization.reversal', 'ach.early.funds', 'ach.early.funds.reversed', 'ach.push.pending', 'ach.pull.pending', 'ach.push', 'ach.pull', 'ach.cancel', 'ach.returned', 'ach.pull.returned', 'ach.push.returned', 'ach.provisional.credit', 'ach.provisional.credit.reversed', 'ach.push.reversal.completed', 'ach.push.reversal.declined', 'ach.jit.push.pending', 'ach.jit.pull.pending', 'ach.jit.push', 'ach.jit.pull', 'ach.jit.cancel', 'ach.jit.pull.returned', 'ach.jit.push.returned', 'check.return.debit', 'check.return.debit.reversal', 'check.clearing.debit', 'accountfunding.pull', 'accountfunding.pull.chargeback', 'escheatment.debit', 'escheatment.debit.reversal', 'escheatment.debit.clearing', 'zero.clearing', 'credit.adjustment', 'debit.adjustment', 'account.transfer', 'account.transfer.reversal', 'unknown')")
        return v

    @validator('state')
    def state_validate_enum(cls, v):
        if v is None:
            return v

        if v not in ('PENDING', 'CLEARED', 'COMPLETION', 'DECLINED', 'ERROR', 'ALL'):
            raise ValueError("must be one of enum values ('PENDING', 'CLEARED', 'COMPLETION', 'DECLINED', 'ERROR', 'ALL')")
        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) -> FraudStreamRequest:
        """Create an instance of FraudStreamRequest 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 card_acceptor
        if self.card_acceptor:
            _dict['card_acceptor'] = self.card_acceptor.to_dict()
        # override the default output from pydantic by calling `to_dict()` of address_verification
        if self.address_verification:
            _dict['address_verification'] = self.address_verification.to_dict()
        return _dict

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

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

        _obj = FraudStreamRequest.parse_obj({
            "program": obj.get("program"),
            "type": obj.get("type"),
            "state": obj.get("state"),
            "itc": obj.get("itc"),
            "token": obj.get("token"),
            "user_token": obj.get("user_token"),
            "acting_user_token": obj.get("acting_user_token"),
            "card_token": obj.get("card_token"),
            "user_transaction_time": obj.get("user_transaction_time"),
            "request_amount": obj.get("request_amount"),
            "amount": obj.get("amount"),
            "currency_code": obj.get("currency_code"),
            "network": obj.get("network"),
            "account_risk_score": obj.get("account_risk_score"),
            "account_risk_score_reason_code": obj.get("account_risk_score_reason_code"),
            "transaction_risk_score": obj.get("transaction_risk_score"),
            "transaction_risk_score_reason_code": obj.get("transaction_risk_score_reason_code"),
            "card_acceptor": TransactionCardAcceptorViewModelV1.from_dict(obj.get("card_acceptor")) if obj.get("card_acceptor") is not None else None,
            "address_verification": AddressVerificationModel.from_dict(obj.get("address_verification")) if obj.get("address_verification") is not None else None
        })
        return _obj

