"""paypalserversdk.

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

# ruff: noqa: E501

class TenureType(object):
    """Implementation of the 'Tenure Type' enum.

    The tenure type of the billing cycle identifies if the billing cycle is a
    trial(free or discounted) or regular billing cycle., The tenure type of the
    billing cycle. In case of a plan having trial cycle, only 2 trial cycles are
    allowed per plan., The type of the billing cycle.

    Attributes:
        REGULAR: A regular billing cycle to identify recurring charges for the
            billing agreement.
        TRIAL: A trial billing cycle to identify free or discounted charge for the
            billing agreement. Free trails will not have a price object in pricing
            scheme where as a discounted trial would have a discounted price compared
            to regular billing cycle.

    """

    REGULAR = "REGULAR"

    TRIAL = "TRIAL"

    @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
