# 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
from marqeta_client.models.card_life_cycle import CardLifeCycle
from marqeta_client.models.card_product_fulfillment import CardProductFulfillment
from marqeta_client.models.clearing_and_settlement import ClearingAndSettlement
from marqeta_client.models.digital_wallet_tokenization import DigitalWalletTokenization
from marqeta_client.models.jit_funding import JitFunding
from marqeta_client.models.poi import Poi
from marqeta_client.models.selective_auth import SelectiveAuth
from marqeta_client.models.special import Special
from marqeta_client.models.transaction_controls import TransactionControls

class CardProductConfig(BaseModel):
    """
    CardProductConfig
    """
    poi: Optional[Poi] = None
    transaction_controls: Optional[TransactionControls] = None
    selective_auth: Optional[SelectiveAuth] = None
    special: Optional[Special] = None
    card_life_cycle: Optional[CardLifeCycle] = None
    clearing_and_settlement: Optional[ClearingAndSettlement] = None
    jit_funding: Optional[JitFunding] = None
    digital_wallet_tokenization: Optional[DigitalWalletTokenization] = None
    fulfillment: Optional[CardProductFulfillment] = None
    __properties = ["poi", "transaction_controls", "selective_auth", "special", "card_life_cycle", "clearing_and_settlement", "jit_funding", "digital_wallet_tokenization", "fulfillment"]

    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) -> CardProductConfig:
        """Create an instance of CardProductConfig 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 poi
        if self.poi:
            _dict['poi'] = self.poi.to_dict()
        # override the default output from pydantic by calling `to_dict()` of transaction_controls
        if self.transaction_controls:
            _dict['transaction_controls'] = self.transaction_controls.to_dict()
        # override the default output from pydantic by calling `to_dict()` of selective_auth
        if self.selective_auth:
            _dict['selective_auth'] = self.selective_auth.to_dict()
        # override the default output from pydantic by calling `to_dict()` of special
        if self.special:
            _dict['special'] = self.special.to_dict()
        # override the default output from pydantic by calling `to_dict()` of card_life_cycle
        if self.card_life_cycle:
            _dict['card_life_cycle'] = self.card_life_cycle.to_dict()
        # override the default output from pydantic by calling `to_dict()` of clearing_and_settlement
        if self.clearing_and_settlement:
            _dict['clearing_and_settlement'] = self.clearing_and_settlement.to_dict()
        # override the default output from pydantic by calling `to_dict()` of jit_funding
        if self.jit_funding:
            _dict['jit_funding'] = self.jit_funding.to_dict()
        # override the default output from pydantic by calling `to_dict()` of digital_wallet_tokenization
        if self.digital_wallet_tokenization:
            _dict['digital_wallet_tokenization'] = self.digital_wallet_tokenization.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fulfillment
        if self.fulfillment:
            _dict['fulfillment'] = self.fulfillment.to_dict()
        return _dict

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

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

        _obj = CardProductConfig.parse_obj({
            "poi": Poi.from_dict(obj.get("poi")) if obj.get("poi") is not None else None,
            "transaction_controls": TransactionControls.from_dict(obj.get("transaction_controls")) if obj.get("transaction_controls") is not None else None,
            "selective_auth": SelectiveAuth.from_dict(obj.get("selective_auth")) if obj.get("selective_auth") is not None else None,
            "special": Special.from_dict(obj.get("special")) if obj.get("special") is not None else None,
            "card_life_cycle": CardLifeCycle.from_dict(obj.get("card_life_cycle")) if obj.get("card_life_cycle") is not None else None,
            "clearing_and_settlement": ClearingAndSettlement.from_dict(obj.get("clearing_and_settlement")) if obj.get("clearing_and_settlement") is not None else None,
            "jit_funding": JitFunding.from_dict(obj.get("jit_funding")) if obj.get("jit_funding") is not None else None,
            "digital_wallet_tokenization": DigitalWalletTokenization.from_dict(obj.get("digital_wallet_tokenization")) if obj.get("digital_wallet_tokenization") is not None else None,
            "fulfillment": CardProductFulfillment.from_dict(obj.get("fulfillment")) if obj.get("fulfillment") is not None else None
        })
        return _obj

