# 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, Field, StrictBool, StrictStr, constr
from marqeta_client.models.avs_controls import AvsControls
from marqeta_client.models.strong_customer_authentication_limits import StrongCustomerAuthenticationLimits

class TransactionControls(BaseModel):
    """
    TransactionControls
    """
    accepted_countries_token: Optional[StrictStr] = Field(None, description="50 char max (default = accept_us_only)")
    always_require_pin: Optional[StrictBool] = False
    always_require_icc: Optional[StrictBool] = False
    allow_gpa_auth: Optional[StrictBool] = False
    require_card_not_present_card_security_code: Optional[StrictBool] = False
    allow_mcc_group_authorization_controls: Optional[StrictBool] = False
    allow_first_pin_set_via_financial_transaction: Optional[StrictBool] = False
    ignore_card_suspended_state: Optional[StrictBool] = False
    allow_chip_fallback: Optional[StrictBool] = False
    allow_network_load: Optional[StrictBool] = False
    allow_network_load_card_activation: Optional[StrictBool] = False
    allow_quasi_cash: Optional[StrictBool] = False
    quasi_cash_exempt_merchant_group_token: Optional[constr(strict=True, max_length=36, min_length=1)] = Field(None, description="36 char max")
    enable_partial_auth_approval: Optional[StrictBool] = False
    address_verification: Optional[AvsControls] = None
    notification_language: Optional[StrictStr] = None
    strong_customer_authentication_limits: Optional[StrongCustomerAuthenticationLimits] = None
    quasi_cash_exempt_mids: Optional[StrictStr] = None
    enable_credit_service: Optional[StrictBool] = False
    __properties = ["accepted_countries_token", "always_require_pin", "always_require_icc", "allow_gpa_auth", "require_card_not_present_card_security_code", "allow_mcc_group_authorization_controls", "allow_first_pin_set_via_financial_transaction", "ignore_card_suspended_state", "allow_chip_fallback", "allow_network_load", "allow_network_load_card_activation", "allow_quasi_cash", "quasi_cash_exempt_merchant_group_token", "enable_partial_auth_approval", "address_verification", "notification_language", "strong_customer_authentication_limits", "quasi_cash_exempt_mids", "enable_credit_service"]

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

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

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

        _obj = TransactionControls.parse_obj({
            "accepted_countries_token": obj.get("accepted_countries_token"),
            "always_require_pin": obj.get("always_require_pin") if obj.get("always_require_pin") is not None else False,
            "always_require_icc": obj.get("always_require_icc") if obj.get("always_require_icc") is not None else False,
            "allow_gpa_auth": obj.get("allow_gpa_auth") if obj.get("allow_gpa_auth") is not None else False,
            "require_card_not_present_card_security_code": obj.get("require_card_not_present_card_security_code") if obj.get("require_card_not_present_card_security_code") is not None else False,
            "allow_mcc_group_authorization_controls": obj.get("allow_mcc_group_authorization_controls") if obj.get("allow_mcc_group_authorization_controls") is not None else False,
            "allow_first_pin_set_via_financial_transaction": obj.get("allow_first_pin_set_via_financial_transaction") if obj.get("allow_first_pin_set_via_financial_transaction") is not None else False,
            "ignore_card_suspended_state": obj.get("ignore_card_suspended_state") if obj.get("ignore_card_suspended_state") is not None else False,
            "allow_chip_fallback": obj.get("allow_chip_fallback") if obj.get("allow_chip_fallback") is not None else False,
            "allow_network_load": obj.get("allow_network_load") if obj.get("allow_network_load") is not None else False,
            "allow_network_load_card_activation": obj.get("allow_network_load_card_activation") if obj.get("allow_network_load_card_activation") is not None else False,
            "allow_quasi_cash": obj.get("allow_quasi_cash") if obj.get("allow_quasi_cash") is not None else False,
            "quasi_cash_exempt_merchant_group_token": obj.get("quasi_cash_exempt_merchant_group_token"),
            "enable_partial_auth_approval": obj.get("enable_partial_auth_approval") if obj.get("enable_partial_auth_approval") is not None else False,
            "address_verification": AvsControls.from_dict(obj.get("address_verification")) if obj.get("address_verification") is not None else None,
            "notification_language": obj.get("notification_language"),
            "strong_customer_authentication_limits": StrongCustomerAuthenticationLimits.from_dict(obj.get("strong_customer_authentication_limits")) if obj.get("strong_customer_authentication_limits") is not None else None,
            "quasi_cash_exempt_mids": obj.get("quasi_cash_exempt_mids"),
            "enable_credit_service": obj.get("enable_credit_service") if obj.get("enable_credit_service") is not None else False
        })
        return _obj

