# 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, constr
from marqeta_client.models.billing_address import BillingAddress
from marqeta_client.models.original_credit import OriginalCredit
from marqeta_client.models.track1_data import Track1Data

class AdvancedAuthCardOptions(BaseModel):
    """
    AdvancedAuthCardOptions
    """
    cvv: Optional[constr(strict=True, max_length=3, min_length=0)] = None
    expiration: Optional[constr(strict=True, max_length=4, min_length=4)] = None
    billing_address: Optional[BillingAddress] = None
    track1_data: Optional[Track1Data] = None
    track2_data: Optional[Track1Data] = None
    original_credit: Optional[OriginalCredit] = None
    __properties = ["cvv", "expiration", "billing_address", "track1_data", "track2_data", "original_credit"]

    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) -> AdvancedAuthCardOptions:
        """Create an instance of AdvancedAuthCardOptions 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 billing_address
        if self.billing_address:
            _dict['billing_address'] = self.billing_address.to_dict()
        # override the default output from pydantic by calling `to_dict()` of track1_data
        if self.track1_data:
            _dict['track1_data'] = self.track1_data.to_dict()
        # override the default output from pydantic by calling `to_dict()` of track2_data
        if self.track2_data:
            _dict['track2_data'] = self.track2_data.to_dict()
        # override the default output from pydantic by calling `to_dict()` of original_credit
        if self.original_credit:
            _dict['original_credit'] = self.original_credit.to_dict()
        return _dict

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

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

        _obj = AdvancedAuthCardOptions.parse_obj({
            "cvv": obj.get("cvv"),
            "expiration": obj.get("expiration"),
            "billing_address": BillingAddress.from_dict(obj.get("billing_address")) if obj.get("billing_address") is not None else None,
            "track1_data": Track1Data.from_dict(obj.get("track1_data")) if obj.get("track1_data") is not None else None,
            "track2_data": Track1Data.from_dict(obj.get("track2_data")) if obj.get("track2_data") is not None else None,
            "original_credit": OriginalCredit.from_dict(obj.get("original_credit")) if obj.get("original_credit") is not None else None
        })
        return _obj

