"""visaacceptancemergedspec.

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

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


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

    Attributes:
        mtype (str): The kind of seller protection in force for the transaction. This
            field is returned only when the protection eligibility value is set to
            ELIGIBLE or PARTIALLY_ELIGIBLE. Possible values -
            ITEM_NOT_RECEIVED_ELIGIBLE: Sellers are protected against claims for
            items not received. - UNAUTHORIZED_PAYMENT_ELIGIBLE: Sellers are
            protected against claims for unauthorized payments. One or both values
            can be returned.
        eligibility (str): Indicates whether the transaction is eligible for seller
            protection. The values returned are described below. Possible values: -
            `ELIGIBLE` - `PARTIALLY_ELIGIBLE` - `INELIGIBLE` - `NOT_ELIGIBLE`
        dispute_categories (List[str]): An array of conditions that are covered for
            the transaction.
        eligibility_type (str): The kind of seller protection in force for the
            transaction. This field is returned only when the protection_eligibility
            property is set to ELIGIBLE or PARTIALLY_ELIGIBLE. Possible values: -
            `ITEM_NOT_RECEIVED_ELIGIBLE: Sellers are protected against claims for
            items not received.` - `UNAUTHORIZED_PAYMENT_ELIGIBLE: Sellers are
            protected against claims for unauthorized payments.` One or both values
            can be returned.
        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",
        "eligibility": "eligibility",
        "dispute_categories": "disputeCategories",
        "eligibility_type": "eligibilityType",
    }

    _optionals = [
        "mtype",
        "eligibility",
        "dispute_categories",
        "eligibility_type",
    ]

    def __init__(
        self,
        mtype=APIHelper.SKIP,
        eligibility=APIHelper.SKIP,
        dispute_categories=APIHelper.SKIP,
        eligibility_type=APIHelper.SKIP,
        additional_properties=None):
        """Initialize a SellerProtection instance."""
        # Initialize members of the class
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype
        if eligibility is not APIHelper.SKIP:
            self.eligibility = eligibility
        if dispute_categories is not APIHelper.SKIP:
            self.dispute_categories = dispute_categories
        if eligibility_type is not APIHelper.SKIP:
            self.eligibility_type = eligibility_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
        eligibility =\
            dictionary.get("eligibility")\
            if dictionary.get("eligibility")\
                else APIHelper.SKIP
        dispute_categories =\
            dictionary.get("disputeCategories")\
            if dictionary.get("disputeCategories")\
                else APIHelper.SKIP
        eligibility_type =\
            dictionary.get("eligibilityType")\
            if dictionary.get("eligibilityType")\
                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,
                   eligibility,
                   dispute_categories,
                   eligibility_type,
                   additional_properties)

    def __repr__(self):
        """Return a unambiguous string representation."""
        _mtype=(
            self.mtype
            if hasattr(self, "mtype")
            else None
        )
        _eligibility=(
            self.eligibility
            if hasattr(self, "eligibility")
            else None
        )
        _dispute_categories=(
            self.dispute_categories
            if hasattr(self, "dispute_categories")
            else None
        )
        _eligibility_type=(
            self.eligibility_type
            if hasattr(self, "eligibility_type")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"mtype={_mtype!r}, "
            f"eligibility={_eligibility!r}, "
            f"dispute_categories={_dispute_categories!r}, "
            f"eligibility_type={_eligibility_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
        )
        _eligibility=(
            self.eligibility
            if hasattr(self, "eligibility")
            else None
        )
        _dispute_categories=(
            self.dispute_categories
            if hasattr(self, "dispute_categories")
            else None
        )
        _eligibility_type=(
            self.eligibility_type
            if hasattr(self, "eligibility_type")
            else None
        )
        _additional_properties=self.additional_properties
        return (
            f"{self.__class__.__name__}("
            f"mtype={_mtype!s}, "
            f"eligibility={_eligibility!s}, "
            f"dispute_categories={_dispute_categories!s}, "
            f"eligibility_type={_eligibility_type!s}, "
            f"additional_properties={_additional_properties!s}, "
            f")"
        )
