# coding: utf-8

"""
    Cloudbeds Accounting Service API

    The Cloudbeds Accounting Service API provides programmatic access to financial data and operations for hospitality properties. Use this API to manage transactions, folios, deposits, accounts receivable ledgers, trial balances, and related accounting configuration.  **Key concepts:** - **Transactions** represent individual financial entries (charges, payments,   taxes, fees) associated with a source such as a reservation, group profile,   or house account.  - **Folios** organize transactions into logical groups within a source. You   can create custom folios and move or route transactions between them.  - **Source Balances** provide a real-time financial summary (charges, payments,   balance due, tax/fee breakdowns) for a reservation, group profile, house   account, or accounts receivable ledger.  - **Accounts Receivable (AR) Ledgers** track outstanding balances that have   been transferred from reservations or group profiles for later collection.  - **Trial Balance** is a daily financial reconciliation report that summarizes   ledger activity across guest, deposit, and AR ledgers.  - **Custom Codes** let you map Cloudbeds internal transaction codes to your   own chart-of-accounts codes and general ledger codes.   **Authentication:** All endpoints require a valid OAuth2 bearer token. Endpoints are protected by scopes: `read:payment` for read operations and `write:payment` for mutating operations. A few search endpoints use POST with a request body to support complex filter criteria; these require the `read:payment` scope.  **Base URL:** Use `https://api.cloudbeds.com` for production and `https://api.cloudbeds-stage.com` for staging. All endpoint paths are prefixed with `/accounting/v1.0`.  **Property context:** Every request must include the `X-Property-ID` header to identify which property the request applies to.  **Monetary amounts:** Unless otherwise noted, monetary amounts are expressed in the smallest currency unit (e.g., cents for USD). Use the `currencyScale` field to determine the number of decimal places.  **Pagination:** Paginated endpoints return a `nextPageToken` value. Pass this token in subsequent requests to retrieve the next page of results. When `nextPageToken` is null or absent, you have reached the last page. 

    The version of the OpenAPI document: v0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import json
from enum import Enum
from typing_extensions import Self


class ApiErrorCode(str, Enum):
    """
    Error code indicating the type of failure. Use this value for programmatic error handling. - `UNKNOWN_ERROR` — An unclassified error occurred. Contact support if this persists. - `UNEXPECTED_ERROR` — An unexpected internal error occurred. Retry the request or contact support. - `ACCESS_DENIED` — You do not have permission to perform this operation on the specified property. - `INVALID_REQUEST` — The request body or parameters are invalid. Check the errorDetails field for specifics. - `NOT_UNIQUE_VALUE` — A value that must be unique (such as a name or code) already exists. - `INVALID_USER_INFORMATION` — The user information provided is invalid or could not be resolved. - `ENTITY_NOT_FOUND` — The requested entity was not found. - `ACCOUNTS_RECEIVABLE_LEDGER_FEATURE_DISABLED` — The accounts receivable ledger feature is not enabled for this property. - `BOOKING_NOT_FOUND` — The specified reservation or booking was not found. - `ACCOUNTS_RECEIVABLE_LEDGER_NOT_FOUND` — The specified accounts receivable ledger was not found. - `ACCOUNTS_RECEIVABLE_LEDGER_STATUS_ERROR` — The AR ledger is in a status that does not allow this operation (e.g., attempting to transfer to a closed ledger). - `BOOKING_STATUS_ERROR` — The reservation is in a status that does not allow this operation. - `GROUP_PROFILE_NOT_FOUND` — The specified group profile was not found. - `GROUP_PROFILE_STATUS_ERROR` — The group profile is in a status that does not allow this operation. - `GROUP_PROFILE_FOLIO_ERROR` — An error occurred with the group profile folio (e.g., the specified folio does not belong to the group profile). 
    """

    """
    allowed enum values
    """
    UNKNOWN_ERROR = 'UNKNOWN_ERROR'
    UNEXPECTED_ERROR = 'UNEXPECTED_ERROR'
    ACCESS_DENIED = 'ACCESS_DENIED'
    INVALID_REQUEST = 'INVALID_REQUEST'
    NOT_UNIQUE_VALUE = 'NOT_UNIQUE_VALUE'
    INVALID_USER_INFORMATION = 'INVALID_USER_INFORMATION'
    ENTITY_NOT_FOUND = 'ENTITY_NOT_FOUND'
    ACCOUNTS_RECEIVABLE_LEDGER_FEATURE_DISABLED = 'ACCOUNTS_RECEIVABLE_LEDGER_FEATURE_DISABLED'
    BOOKING_NOT_FOUND = 'BOOKING_NOT_FOUND'
    ACCOUNTS_RECEIVABLE_LEDGER_NOT_FOUND = 'ACCOUNTS_RECEIVABLE_LEDGER_NOT_FOUND'
    ACCOUNTS_RECEIVABLE_LEDGER_STATUS_ERROR = 'ACCOUNTS_RECEIVABLE_LEDGER_STATUS_ERROR'
    BOOKING_STATUS_ERROR = 'BOOKING_STATUS_ERROR'
    GROUP_PROFILE_NOT_FOUND = 'GROUP_PROFILE_NOT_FOUND'
    GROUP_PROFILE_STATUS_ERROR = 'GROUP_PROFILE_STATUS_ERROR'
    GROUP_PROFILE_FOLIO_ERROR = 'GROUP_PROFILE_FOLIO_ERROR'
    UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api'

    @classmethod
    def from_json(cls, json_str: str) -> Self:
        """Create an instance of ApiErrorCode from a JSON string"""
        return cls(json.loads(json_str))

    @classmethod
    def _missing_(cls, value):
        """Handle unknown enum values by returning the unknown default case."""
        return cls.UNKNOWN_DEFAULT_OPEN_API

