"""cellpointapi.

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

# ruff: noqa: E501

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

    States that a transaction can be in.
    <table>
      <thead>
        <tr>
          <th>Status</th>
          <th>Description</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>AUTHORIZED</td>
          <td>A transaction has been fully authorized and the funds are being
    held.</td>
        </tr>
        <tr>
          <td>AUTHORIZE_FAILED</td>
          <td>Authorization has failed. No funds are being held.</td>
        </tr>
        <tr>
          <td>AUTHORIZE_INITIATED</td>
          <td>A payment authorization has been initiated with CellPoint Digital.</td>
        </tr>
        <tr>
          <td>CANCELED</td>
          <td>Authorization has been canceled and no funds are being held
    anymore.</td>
        </tr>
        <tr>
          <td>CANCELLATION_FAILED</td>
          <td>Cancellation has failed. Funds are still held as part of the
    authorization.</td>
        </tr>
        <tr>
          <td>CANCELLATION_INITIATED</td>
          <td>Cancellation of funds have been initiated and is pending
    completion.</td>
        </tr>
        <tr>
          <td>CAPTURED</td>
          <td>
            Authorized transaction that has been fully captured.
            Depending on how settlement is done by payment processor, funds have been
    moved from buyer's account to merchant's account.
          </td>
        </tr>
        <tr>
          <td>CAPTURE_FAILED</td>
          <td>Capture has failed. Funds are still held as part of the authorization,
    but have not moved.</td>
        </tr>
        <tr>
          <td>CAPTURE_INITIATED</td>
          <td>Capture has been initiated, but is pending completion.</td>
        </tr>
        <tr>
          <td>CAPTURE_PENDING</td>
          <td>Authorization has already happened, and the transaction has now been
    marked as pending for capture. Capture will take place automatically as per
    configured schedule.</td>
        </tr>
        <tr>
          <td>CAPTURE_BATCHED</td>
          <td>Authorization has already happened, and the transaction has been sent
    for capturing in a batch. Capture will finally take place automatically as per
    configured schedule.</td>
        </tr>
        <tr>
          <td>PARTIALLY_CANCELED</td>
          <td>Authorized transaction is partially canceled<td>
        </tr>
        <tr>
          <td>PARTIALLY_CAPTURED</td>
          <td>Authorized transaction is partially captured<td>
        </tr>
        <tr>
          <td>PENDING_ACTION_COMPLETION</td>
          <td>The transaction is in a state where an action has been initiated, but
    is pending completion.</td>
        </tr>
        <tr>
          <td>CLOSED</td>
          <td>The transaction that has previously failed has been closed to avoid its
    stagnation in review pools.</td>
        </tr>
      </tbody>
    </table>

    Attributes:
        AUTHORIZED: The enum member of type str.
        AUTHORIZE_FAILED: The enum member of type str.
        AUTHORIZE_INITIATED: The enum member of type str.
        CANCELED: The enum member of type str.
        CANCELLATION_FAILED: The enum member of type str.
        CANCELLATION_INITIATED: The enum member of type str.
        CAPTURED: The enum member of type str.
        CAPTURE_FAILED: The enum member of type str.
        CAPTURE_INITIATED: The enum member of type str.
        CAPTURE_PENDING: The enum member of type str.
        CAPTURE_BATCHED: The enum member of type str.
        PARTIALLY_CANCELED: The enum member of type str.
        PARTIALLY_CAPTURED: The enum member of type str.
        PENDING_ACTION_COMPLETION: The enum member of type str.
        CLOSED: The enum member of type str.

    """

    _all_values = ["AUTHORIZED", "AUTHORIZE_FAILED", "AUTHORIZE_INITIATED",
        "CANCELED", "CANCELLATION_FAILED", "CANCELLATION_INITIATED", "CAPTURED",
        "CAPTURE_FAILED", "CAPTURE_INITIATED", "CAPTURE_PENDING", "CAPTURE_BATCHED",
        "PARTIALLY_CANCELED", "PARTIALLY_CAPTURED", "PENDING_ACTION_COMPLETION",
        "CLOSED"]
    AUTHORIZED = "AUTHORIZED"

    AUTHORIZE_FAILED = "AUTHORIZE_FAILED"

    AUTHORIZE_INITIATED = "AUTHORIZE_INITIATED"

    CANCELED = "CANCELED"

    CANCELLATION_FAILED = "CANCELLATION_FAILED"

    CANCELLATION_INITIATED = "CANCELLATION_INITIATED"

    CAPTURED = "CAPTURED"

    CAPTURE_FAILED = "CAPTURE_FAILED"

    CAPTURE_INITIATED = "CAPTURE_INITIATED"

    CAPTURE_PENDING = "CAPTURE_PENDING"

    CAPTURE_BATCHED = "CAPTURE_BATCHED"

    PARTIALLY_CANCELED = "PARTIALLY_CANCELED"

    PARTIALLY_CAPTURED = "PARTIALLY_CAPTURED"

    PENDING_ACTION_COMPLETION = "PENDING_ACTION_COMPLETION"

    CLOSED = "CLOSED"

    @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
