"""cellpointapi.

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

# ruff: noqa: E501

class AddressVerificationStatus(object):
    """Implementation of the 'AddressVerificationStatus' enum.

    Address Verification Status (AVS)
    <table>
    <thead>
      <tr>
        <th>AVS Status</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>MATCH</td>
        <td>Both address or postal code match</td>
      </tr>
      <tr>
        <td>PARTIAL_MATCH_POSTAL_CODE_ONLY</td>
        <td>postal code matches but address does not</td>
      </tr>
      <tr>
        <td>PARTIAL_MATCH_ADDRESS_ONLY</td>
        <td>address matches but postal code does not</td>
      </tr>
      <tr>
        <td>FAILURE</td>
        <td>neither address or postal code match</td>
      </tr>
      <tr>
        <td>UNAVAILABLE</td>
        <td>AVS is unavailable for card/country</td>
      </tr>
    </tbody>
    </table>

    Attributes:
        MATCH: The enum member of type str.
        PARTIAL_MATCH_POSTAL_CODE_ONLY: The enum member of type str.
        PARTIAL_MATCH_ADDRESS_ONLY: The enum member of type str.
        FAILURE: The enum member of type str.
        UNAVAILABLE: The enum member of type str.

    """

    _all_values = ["MATCH", "PARTIAL_MATCH_POSTAL_CODE_ONLY",
        "PARTIAL_MATCH_ADDRESS_ONLY", "FAILURE", "UNAVAILABLE"]
    MATCH = "MATCH"

    PARTIAL_MATCH_POSTAL_CODE_ONLY = "PARTIAL_MATCH_POSTAL_CODE_ONLY"

    PARTIAL_MATCH_ADDRESS_ONLY = "PARTIAL_MATCH_ADDRESS_ONLY"

    FAILURE = "FAILURE"

    UNAVAILABLE = "UNAVAILABLE"

    @classmethod
    def validate(cls, value):
        """Validate value contains in enum

        Args:
            value: the value to be validated

        Returns:
            boolean : if value is valid enum values.

        """
        return value in cls._all_values

    @classmethod
    def from_value(cls, value, default=None):
        """Return the matching enum value for the given input."""
        if value is None:
            return default

        # If numeric and matches directly
        if isinstance(value, int):
            for name, val in cls.__dict__.items():
                if not name.startswith("_") and val == value:
                    return val

        # If string, perform case-insensitive match
        if isinstance(value, str):
            value_lower = value.lower()
            for name, val in cls.__dict__.items():
                if not name.startswith("_") and (
                    name.lower() == value_lower or str(val).lower() == value_lower
                ):
                    return val

        # Fallback to default
        return default
