"""paypalserversdk.

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

# ruff: noqa: E501

class StandardEntryClassCode(object):
    """Implementation of the 'Standard Entry Class Code' enum.

    NACHA (the regulatory body governing the ACH network) requires that API callers
    (merchants, partners) obtain the consumer’s explicit authorization before
    initiating a transaction. To stay compliant, you’ll need to make sure that you
    retain a compliant authorization for each transaction that you originate to the
    ACH Network using this API. ACH transactions are categorized (using SEC codes) by
    how you capture authorization from the Receiver (the person whose bank account is
    being debited or credited). PayPal supports the following SEC codes.

    Attributes:
        TEL: The API caller (merchant/partner) accepts authorization and payment
            information from a consumer over the telephone.
        WEB: The API caller (merchant/partner) accepts Debit transactions from a
            consumer on their website.
        CCD: Cash concentration and disbursement for corporate debit transaction.
            Used to disburse or consolidate funds. Entries are usually Optional
            high-dollar, low-volume, and time-critical. (e.g. intra-company transfers
            or invoice payments to suppliers).
        PPD: Prearranged payment and deposit entries. Used for debit payments
            authorized by a consumer account holder, and usually initiated by a
            company. These are usually recurring debits (such as insurance premiums).

    """

    TEL = "TEL"

    WEB = "WEB"

    CCD = "CCD"

    PPD = "PPD"

    @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
