# coding: utf-8

"""
    Trinsic API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: v1
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field
from typing import Any, ClassVar, Dict, List, Optional
from trinsic_api.models.aadhaar_input import AadhaarInput
from trinsic_api.models.bangladesh_national_id_input import BangladeshNationalIdInput
from trinsic_api.models.brazil_cpf_check_input import BrazilCpfCheckInput
from trinsic_api.models.brazil_digital_cnh_input import BrazilDigitalCnhInput
from trinsic_api.models.idin_input import IdinInput
from trinsic_api.models.indonesia_nik_input import IndonesiaNikInput
from trinsic_api.models.kenya_nid_input import KenyaNidInput
from trinsic_api.models.mexico_curp_input import MexicoCurpInput
from trinsic_api.models.mobile_id_input import MobileIdInput
from trinsic_api.models.nigeria_nin_input import NigeriaNinInput
from trinsic_api.models.philippine_match_input import PhilippineMatchInput
from trinsic_api.models.philippine_qr_input import PhilippineQRInput
from trinsic_api.models.smart_id_input import SmartIdInput
from trinsic_api.models.south_africa_nid_input import SouthAfricaNidInput
from trinsic_api.models.spid_input import SpidInput
from trinsic_api.models.trinsic_test_database_lookup_input import TrinsicTestDatabaseLookupInput
from trinsic_api.models.trinsic_test_sub_providers_input import TrinsicTestSubProvidersInput
from typing import Optional, Set
from typing_extensions import Self

class ProviderInput(BaseModel):
    """
    ProviderInput
    """ # noqa: E501
    indonesia_nik: Optional[IndonesiaNikInput] = Field(default=None, description="Input for the `f-indonesia-nik` provider", alias="indonesiaNik")
    mexico_curp: Optional[MexicoCurpInput] = Field(default=None, description="Input for the `f-mexico-curp` provider", alias="mexicoCurp")
    south_africa_nid: Optional[SouthAfricaNidInput] = Field(default=None, description="Input for the `f-south-africa-nid` provider", alias="southAfricaNid")
    kenya_nid: Optional[KenyaNidInput] = Field(default=None, description="Input for the `f-kenya-nid` provider", alias="kenyaNid")
    nigeria_nin: Optional[NigeriaNinInput] = Field(default=None, description="Input for the `f-nigeria-nin` provider", alias="nigeriaNin")
    aadhaar: Optional[AadhaarInput] = Field(default=None, description="Input for the `f-india-aadhaar-match` provider")
    bangladesh_national_id: Optional[BangladeshNationalIdInput] = Field(default=None, description="Input for the `bangladesh-nid` provider", alias="bangladeshNationalId")
    brazil_cpf_check: Optional[BrazilCpfCheckInput] = Field(default=None, description="Input for the `g-brazil-cpf` provider", alias="brazilCpfCheck")
    brazil_digital_cnh: Optional[BrazilDigitalCnhInput] = Field(default=None, description="Input for the `g-brazil-digital-cnh` provider", alias="brazilDigitalCnh")
    philippine_match: Optional[PhilippineMatchInput] = Field(default=None, description="Input for the `b-philsys-biometric` provider", alias="philippineMatch")
    philippine_qr: Optional[PhilippineQRInput] = Field(default=None, description="Input for the `b-philippine-qr-digital-national-id` and `b-philippine-qr-ephill-id` providers", alias="philippineQR")
    smart_id: Optional[SmartIdInput] = Field(default=None, description="Input for the `smart-id` provider", alias="smartId")
    mobile_id: Optional[MobileIdInput] = Field(default=None, description="Input for the `mobile-id` provider", alias="mobileId")
    idin: Optional[IdinInput] = Field(default=None, description="Input for the `idin` provider")
    spid: Optional[SpidInput] = Field(default=None, description="Input for the `spid` provider")
    trinsic_test_database_lookup: Optional[TrinsicTestDatabaseLookupInput] = Field(default=None, description="*TEST MODE ONLY.*              Input for the `trinsic-test-database-lookup` provider", alias="trinsicTestDatabaseLookup")
    trinsic_test_sub_providers: Optional[TrinsicTestSubProvidersInput] = Field(default=None, description="*TEST MODE ONLY.*              Input for the `trinsic-test-sub-providers` provider", alias="trinsicTestSubProviders")
    __properties: ClassVar[List[str]] = ["indonesiaNik", "mexicoCurp", "southAfricaNid", "kenyaNid", "nigeriaNin", "aadhaar", "bangladeshNationalId", "brazilCpfCheck", "brazilDigitalCnh", "philippineMatch", "philippineQR", "smartId", "mobileId", "idin", "spid", "trinsicTestDatabaseLookup", "trinsicTestSubProviders"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of ProviderInput from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of indonesia_nik
        if self.indonesia_nik:
            _dict['indonesiaNik'] = self.indonesia_nik.to_dict()
        # override the default output from pydantic by calling `to_dict()` of mexico_curp
        if self.mexico_curp:
            _dict['mexicoCurp'] = self.mexico_curp.to_dict()
        # override the default output from pydantic by calling `to_dict()` of south_africa_nid
        if self.south_africa_nid:
            _dict['southAfricaNid'] = self.south_africa_nid.to_dict()
        # override the default output from pydantic by calling `to_dict()` of kenya_nid
        if self.kenya_nid:
            _dict['kenyaNid'] = self.kenya_nid.to_dict()
        # override the default output from pydantic by calling `to_dict()` of nigeria_nin
        if self.nigeria_nin:
            _dict['nigeriaNin'] = self.nigeria_nin.to_dict()
        # override the default output from pydantic by calling `to_dict()` of aadhaar
        if self.aadhaar:
            _dict['aadhaar'] = self.aadhaar.to_dict()
        # override the default output from pydantic by calling `to_dict()` of bangladesh_national_id
        if self.bangladesh_national_id:
            _dict['bangladeshNationalId'] = self.bangladesh_national_id.to_dict()
        # override the default output from pydantic by calling `to_dict()` of brazil_cpf_check
        if self.brazil_cpf_check:
            _dict['brazilCpfCheck'] = self.brazil_cpf_check.to_dict()
        # override the default output from pydantic by calling `to_dict()` of brazil_digital_cnh
        if self.brazil_digital_cnh:
            _dict['brazilDigitalCnh'] = self.brazil_digital_cnh.to_dict()
        # override the default output from pydantic by calling `to_dict()` of philippine_match
        if self.philippine_match:
            _dict['philippineMatch'] = self.philippine_match.to_dict()
        # override the default output from pydantic by calling `to_dict()` of philippine_qr
        if self.philippine_qr:
            _dict['philippineQR'] = self.philippine_qr.to_dict()
        # override the default output from pydantic by calling `to_dict()` of smart_id
        if self.smart_id:
            _dict['smartId'] = self.smart_id.to_dict()
        # override the default output from pydantic by calling `to_dict()` of mobile_id
        if self.mobile_id:
            _dict['mobileId'] = self.mobile_id.to_dict()
        # override the default output from pydantic by calling `to_dict()` of idin
        if self.idin:
            _dict['idin'] = self.idin.to_dict()
        # override the default output from pydantic by calling `to_dict()` of spid
        if self.spid:
            _dict['spid'] = self.spid.to_dict()
        # override the default output from pydantic by calling `to_dict()` of trinsic_test_database_lookup
        if self.trinsic_test_database_lookup:
            _dict['trinsicTestDatabaseLookup'] = self.trinsic_test_database_lookup.to_dict()
        # override the default output from pydantic by calling `to_dict()` of trinsic_test_sub_providers
        if self.trinsic_test_sub_providers:
            _dict['trinsicTestSubProviders'] = self.trinsic_test_sub_providers.to_dict()
        # set to None if indonesia_nik (nullable) is None
        # and model_fields_set contains the field
        if self.indonesia_nik is None and "indonesia_nik" in self.model_fields_set:
            _dict['indonesiaNik'] = None

        # set to None if mexico_curp (nullable) is None
        # and model_fields_set contains the field
        if self.mexico_curp is None and "mexico_curp" in self.model_fields_set:
            _dict['mexicoCurp'] = None

        # set to None if south_africa_nid (nullable) is None
        # and model_fields_set contains the field
        if self.south_africa_nid is None and "south_africa_nid" in self.model_fields_set:
            _dict['southAfricaNid'] = None

        # set to None if kenya_nid (nullable) is None
        # and model_fields_set contains the field
        if self.kenya_nid is None and "kenya_nid" in self.model_fields_set:
            _dict['kenyaNid'] = None

        # set to None if nigeria_nin (nullable) is None
        # and model_fields_set contains the field
        if self.nigeria_nin is None and "nigeria_nin" in self.model_fields_set:
            _dict['nigeriaNin'] = None

        # set to None if aadhaar (nullable) is None
        # and model_fields_set contains the field
        if self.aadhaar is None and "aadhaar" in self.model_fields_set:
            _dict['aadhaar'] = None

        # set to None if bangladesh_national_id (nullable) is None
        # and model_fields_set contains the field
        if self.bangladesh_national_id is None and "bangladesh_national_id" in self.model_fields_set:
            _dict['bangladeshNationalId'] = None

        # set to None if brazil_cpf_check (nullable) is None
        # and model_fields_set contains the field
        if self.brazil_cpf_check is None and "brazil_cpf_check" in self.model_fields_set:
            _dict['brazilCpfCheck'] = None

        # set to None if brazil_digital_cnh (nullable) is None
        # and model_fields_set contains the field
        if self.brazil_digital_cnh is None and "brazil_digital_cnh" in self.model_fields_set:
            _dict['brazilDigitalCnh'] = None

        # set to None if philippine_match (nullable) is None
        # and model_fields_set contains the field
        if self.philippine_match is None and "philippine_match" in self.model_fields_set:
            _dict['philippineMatch'] = None

        # set to None if philippine_qr (nullable) is None
        # and model_fields_set contains the field
        if self.philippine_qr is None and "philippine_qr" in self.model_fields_set:
            _dict['philippineQR'] = None

        # set to None if smart_id (nullable) is None
        # and model_fields_set contains the field
        if self.smart_id is None and "smart_id" in self.model_fields_set:
            _dict['smartId'] = None

        # set to None if mobile_id (nullable) is None
        # and model_fields_set contains the field
        if self.mobile_id is None and "mobile_id" in self.model_fields_set:
            _dict['mobileId'] = None

        # set to None if idin (nullable) is None
        # and model_fields_set contains the field
        if self.idin is None and "idin" in self.model_fields_set:
            _dict['idin'] = None

        # set to None if spid (nullable) is None
        # and model_fields_set contains the field
        if self.spid is None and "spid" in self.model_fields_set:
            _dict['spid'] = None

        # set to None if trinsic_test_database_lookup (nullable) is None
        # and model_fields_set contains the field
        if self.trinsic_test_database_lookup is None and "trinsic_test_database_lookup" in self.model_fields_set:
            _dict['trinsicTestDatabaseLookup'] = None

        # set to None if trinsic_test_sub_providers (nullable) is None
        # and model_fields_set contains the field
        if self.trinsic_test_sub_providers is None and "trinsic_test_sub_providers" in self.model_fields_set:
            _dict['trinsicTestSubProviders'] = None

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of ProviderInput from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "indonesiaNik": IndonesiaNikInput.from_dict(obj["indonesiaNik"]) if obj.get("indonesiaNik") is not None else None,
            "mexicoCurp": MexicoCurpInput.from_dict(obj["mexicoCurp"]) if obj.get("mexicoCurp") is not None else None,
            "southAfricaNid": SouthAfricaNidInput.from_dict(obj["southAfricaNid"]) if obj.get("southAfricaNid") is not None else None,
            "kenyaNid": KenyaNidInput.from_dict(obj["kenyaNid"]) if obj.get("kenyaNid") is not None else None,
            "nigeriaNin": NigeriaNinInput.from_dict(obj["nigeriaNin"]) if obj.get("nigeriaNin") is not None else None,
            "aadhaar": AadhaarInput.from_dict(obj["aadhaar"]) if obj.get("aadhaar") is not None else None,
            "bangladeshNationalId": BangladeshNationalIdInput.from_dict(obj["bangladeshNationalId"]) if obj.get("bangladeshNationalId") is not None else None,
            "brazilCpfCheck": BrazilCpfCheckInput.from_dict(obj["brazilCpfCheck"]) if obj.get("brazilCpfCheck") is not None else None,
            "brazilDigitalCnh": BrazilDigitalCnhInput.from_dict(obj["brazilDigitalCnh"]) if obj.get("brazilDigitalCnh") is not None else None,
            "philippineMatch": PhilippineMatchInput.from_dict(obj["philippineMatch"]) if obj.get("philippineMatch") is not None else None,
            "philippineQR": PhilippineQRInput.from_dict(obj["philippineQR"]) if obj.get("philippineQR") is not None else None,
            "smartId": SmartIdInput.from_dict(obj["smartId"]) if obj.get("smartId") is not None else None,
            "mobileId": MobileIdInput.from_dict(obj["mobileId"]) if obj.get("mobileId") is not None else None,
            "idin": IdinInput.from_dict(obj["idin"]) if obj.get("idin") is not None else None,
            "spid": SpidInput.from_dict(obj["spid"]) if obj.get("spid") is not None else None,
            "trinsicTestDatabaseLookup": TrinsicTestDatabaseLookupInput.from_dict(obj["trinsicTestDatabaseLookup"]) if obj.get("trinsicTestDatabaseLookup") is not None else None,
            "trinsicTestSubProviders": TrinsicTestSubProvidersInput.from_dict(obj["trinsicTestSubProviders"]) if obj.get("trinsicTestSubProviders") is not None else None
        })
        return _obj


