"""visaacceptancemergedspec.

This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""

# ruff: noqa: E501
from visaacceptancemergedspec.api_helper import (
    APIHelper,
)


class LoanOptions(object):
    """Implementation of the 'LoanOptions' model.

    Attributes:
        mtype (str): Type of loan based on an agreement between you and the issuer.
            Examples: AGROCUSTEIO, AGRO-INVEST, BNDES-Type1, CBN, FINAME. This field
            is supported only for these kinds of payments: - BNDES transactions on
            Visa Acceptance through VisaNet. - Installment payments with Mastercard
            on Visa Acceptance through VisaNet in Brazil.  For BNDES transactions,
            the value for this field corresponds to the following data in the TC 33
            capture file: - Record: CP07 TCR2, Position: 27-46, Field: Loan Type  For
            installment payments with Mastercard in Brazil, the value for this field
            corresponds to the following data in the TC 33 capture file: - Record:
            CP07 TCR4, Position: 5-24,Field: Financing Type
        asset_type (str): Indicates whether a loan is for a recoverable item or a
            non-recoverable item. Possible values: - `N`: non-recoverable item - `R`:
            recoverable item This field is supported only for BNDES transactions on
            Visa Acceptance through VisaNet. The value for this field corresponds to
            the following data in the TC 33 capture file5:  Record: CP07 TCR2,
            Position: 26, Field: Asset Indicator
        additional_properties (Dict[str, Any]): The additional properties for the
            model.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "mtype": "type",
        "asset_type": "assetType",
    }

    _optionals = [
        "mtype",
        "asset_type",
    ]

    def __init__(
        self,
        mtype=APIHelper.SKIP,
        asset_type=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a LoanOptions instance."""
        # Initialize members of the class
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype
        if asset_type is not APIHelper.SKIP:
            self.asset_type = asset_type

        # Add additional model properties to the instance
        if additional_properties is None:
            additional_properties = {}
        self.additional_properties = additional_properties

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Create an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """
        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        mtype =\
            dictionary.get("type")\
            if dictionary.get("type")\
                else APIHelper.SKIP
        asset_type =\
            dictionary.get("assetType")\
            if dictionary.get("assetType")\
                else APIHelper.SKIP

        additional_properties = APIHelper.get_additional_properties(
            dictionary={k: v for k, v in dictionary.items()
                        if k not in cls._names.values()},
            unboxing_function=lambda value: value)

        # Return an object of this model
        return cls(mtype,
                   asset_type,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _asset_type=(
            self.asset_type
            if hasattr(self, "asset_type")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"mtype={_mtype!r}, "
            f"asset_type={_asset_type!r}, "
            f"additional_properties={_additional_properties!r}, "
            f")"
        )

    def __str__(self):
        """Return a human-readable string representation."""
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _asset_type=(
            self.asset_type
            if hasattr(self, "asset_type")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"mtype={_mtype!s}, "
            f"asset_type={_asset_type!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
