# 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, StrictBool, StrictFloat, StrictInt, StrictStr, constr, validator

class Iso8583DigitalWalletToken(BaseModel):
    """
    Iso8583DigitalWalletToken
    """
    token_pan: Optional[constr(strict=True, max_length=19, min_length=0)] = None
    token_assurance_level: Optional[constr(strict=True, max_length=2, min_length=0)] = None
    token_requestor_id: Optional[constr(strict=True, max_length=11, min_length=0)] = None
    token_reference_id: Optional[constr(strict=True, max_length=50, min_length=0)] = None
    correlation_id: Optional[constr(strict=True, max_length=50, min_length=0)] = None
    token_expiry_date: Optional[constr(strict=True, max_length=4, min_length=0)] = None
    token_type: Optional[StrictStr] = None
    token_status: Optional[StrictStr] = None
    pan_reference_id: Optional[constr(strict=True, max_length=50, min_length=0)] = None
    network_token_score: Optional[constr(strict=True, max_length=2, min_length=0)] = None
    network_decisioning: Optional[StrictStr] = None
    number_of_active_tokens: Optional[constr(strict=True, max_length=2, min_length=0)] = None
    number_of_inactive_tokens: Optional[constr(strict=True, max_length=2, min_length=0)] = None
    number_of_suspended_tokens: Optional[constr(strict=True, max_length=2, min_length=0)] = None
    issuer_terms_and_condition: Optional[constr(strict=True, max_length=64, min_length=0)] = None
    issuer_terms_and_condition_date: Optional[datetime] = Field(None, description="yyyy-MM-dd, yyyy-MM-ddThh:mm:ssZ")
    elapsed_time_to_live: Optional[StrictInt] = None
    number_of_transactions: Optional[StrictInt] = None
    cumulative_transaction_amount: Optional[Union[StrictFloat, StrictInt]] = None
    number_of_activation_attempts: Optional[StrictInt] = None
    visa_auto_fill_indicator: Optional[StrictBool] = None
    __properties = ["token_pan", "token_assurance_level", "token_requestor_id", "token_reference_id", "correlation_id", "token_expiry_date", "token_type", "token_status", "pan_reference_id", "network_token_score", "network_decisioning", "number_of_active_tokens", "number_of_inactive_tokens", "number_of_suspended_tokens", "issuer_terms_and_condition", "issuer_terms_and_condition_date", "elapsed_time_to_live", "number_of_transactions", "cumulative_transaction_amount", "number_of_activation_attempts", "visa_auto_fill_indicator"]

    @validator('token_type')
    def token_type_validate_enum(cls, v):
        if v is None:
            return v

        if v not in ('DEVICE_SECURE_ELEMENT', 'DEVICE_CLOUD_BASED', 'MERCHANT_CARD_ON_FILE', 'ECOMMERCE_DIGITAL_WALLET', 'PSEUDO_ACCOUNT'):
            raise ValueError("must be one of enum values ('DEVICE_SECURE_ELEMENT', 'DEVICE_CLOUD_BASED', 'MERCHANT_CARD_ON_FILE', 'ECOMMERCE_DIGITAL_WALLET', 'PSEUDO_ACCOUNT')")
        return v

    @validator('token_status')
    def token_status_validate_enum(cls, v):
        if v is None:
            return v

        if v not in ('REQUESTED', 'ACTIVE', 'SUSPENDED', 'TERMINATED'):
            raise ValueError("must be one of enum values ('REQUESTED', 'ACTIVE', 'SUSPENDED', 'TERMINATED')")
        return v

    @validator('network_decisioning')
    def network_decisioning_validate_enum(cls, v):
        if v is None:
            return v

        if v not in ('DECISION_GREEN', 'DECISION_YELLOW', 'DECISION_RED'):
            raise ValueError("must be one of enum values ('DECISION_GREEN', 'DECISION_YELLOW', 'DECISION_RED')")
        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) -> Iso8583DigitalWalletToken:
        """Create an instance of Iso8583DigitalWalletToken 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) -> Iso8583DigitalWalletToken:
        """Create an instance of Iso8583DigitalWalletToken from a dict"""
        if obj is None:
            return None

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

        _obj = Iso8583DigitalWalletToken.parse_obj({
            "token_pan": obj.get("token_pan"),
            "token_assurance_level": obj.get("token_assurance_level"),
            "token_requestor_id": obj.get("token_requestor_id"),
            "token_reference_id": obj.get("token_reference_id"),
            "correlation_id": obj.get("correlation_id"),
            "token_expiry_date": obj.get("token_expiry_date"),
            "token_type": obj.get("token_type"),
            "token_status": obj.get("token_status"),
            "pan_reference_id": obj.get("pan_reference_id"),
            "network_token_score": obj.get("network_token_score"),
            "network_decisioning": obj.get("network_decisioning"),
            "number_of_active_tokens": obj.get("number_of_active_tokens"),
            "number_of_inactive_tokens": obj.get("number_of_inactive_tokens"),
            "number_of_suspended_tokens": obj.get("number_of_suspended_tokens"),
            "issuer_terms_and_condition": obj.get("issuer_terms_and_condition"),
            "issuer_terms_and_condition_date": obj.get("issuer_terms_and_condition_date"),
            "elapsed_time_to_live": obj.get("elapsed_time_to_live"),
            "number_of_transactions": obj.get("number_of_transactions"),
            "cumulative_transaction_amount": obj.get("cumulative_transaction_amount"),
            "number_of_activation_attempts": obj.get("number_of_activation_attempts"),
            "visa_auto_fill_indicator": obj.get("visa_auto_fill_indicator")
        })
        return _obj

