// @generated — do not edit
import { createDomainError } from "@tailor-platform/erp-kit/module";

export const JournalEntryNotFoundError = createDomainError(
  "JournalEntryNotFoundError", "FINANCE_LEDGER_JOURNAL_ENTRY_NOT_FOUND",
  (identifier: string) => `Referenced journal entry does not exist: ${identifier}`,
);

export const InvalidStatusForLineAddError = createDomainError(
  "InvalidStatusForLineAddError", "FINANCE_LEDGER_INVALID_STATUS_FOR_LINE_ADD",
  (identifier: string) => `Journal entry is not in DRAFT status: ${identifier}`,
);

export const AccountNotFoundError = createDomainError(
  "AccountNotFoundError", "FINANCE_LEDGER_ACCOUNT_NOT_FOUND",
  (identifier: string) => `Referenced GL account does not exist: ${identifier}`,
);

export const InvalidDebitCreditError = createDomainError(
  "InvalidDebitCreditError", "FINANCE_LEDGER_INVALID_DEBIT_CREDIT",
  (identifier: string) => `Both debit and credit specified, or both are zero, or amounts are negative: ${identifier}`,
);

export const CurrencyNotFoundError = createDomainError(
  "CurrencyNotFoundError", "FINANCE_LEDGER_CURRENCY_NOT_FOUND",
  (identifier: string) => `Referenced currency does not exist or is not active: ${identifier}`,
);

export const PeriodCloseNotFoundError = createDomainError(
  "PeriodCloseNotFoundError", "FINANCE_LEDGER_PERIOD_CLOSE_NOT_FOUND",
  (identifier: string) => `No PeriodClose record matches the given id: ${identifier}`,
);

export const InvalidStatusTransitionError = createDomainError(
  "InvalidStatusTransitionError", "FINANCE_LEDGER_INVALID_STATUS_TRANSITION",
  (identifier: string) => `PeriodClose is not in UNDER_REVIEW status; only UNDER_REVIEW can transition to SOFT_LOCKED: ${identifier}`,
);

export const InsufficientPermissionsError = createDomainError(
  "InsufficientPermissionsError", "FINANCE_LEDGER_INSUFFICIENT_PERMISSIONS",
  (identifier: string) => `Acting user does not have the required authorization role (controller or finance manager): ${identifier}`,
);

export const AccountingPeriodNotFoundError = createDomainError(
  "AccountingPeriodNotFoundError", "FINANCE_LEDGER_ACCOUNTING_PERIOD_NOT_FOUND",
  (identifier: string) => `Referenced accounting period does not exist: ${identifier}`,
);

export const FiscalYearNotFoundError = createDomainError(
  "FiscalYearNotFoundError", "FINANCE_LEDGER_FISCAL_YEAR_NOT_FOUND",
  (identifier: string) => `Referenced fiscal year does not exist or does not belong to the specified company: ${identifier}`,
);

export const NameRequiredError = createDomainError(
  "NameRequiredError", "FINANCE_LEDGER_NAME_REQUIRED",
  (identifier: string) => `Period name is empty or not provided: ${identifier}`,
);

export const InvalidDateRangeError = createDomainError(
  "InvalidDateRangeError", "FINANCE_LEDGER_INVALID_DATE_RANGE",
  (identifier: string) => `Start date is not strictly before end date: ${identifier}`,
);

export const OverlappingPeriodError = createDomainError(
  "OverlappingPeriodError", "FINANCE_LEDGER_OVERLAPPING_PERIOD",
  (identifier: string) => `The date range overlaps with an existing period within the same fiscal year: ${identifier}`,
);

export const InvalidPeriodTypeError = createDomainError(
  "InvalidPeriodTypeError", "FINANCE_LEDGER_INVALID_PERIOD_TYPE",
  (identifier: string) => `Period type is not a recognized value: ${identifier}`,
);

export const DuplicatePeriodDatesError = createDomainError(
  "DuplicatePeriodDatesError", "FINANCE_LEDGER_DUPLICATE_PERIOD_DATES",
  (identifier: string) => `Two periods have identical start and end dates and neither is an adjustment period: ${identifier}`,
);

export const CompanyNotFoundError = createDomainError(
  "CompanyNotFoundError", "FINANCE_LEDGER_COMPANY_NOT_FOUND",
  (identifier: string) => `Referenced company does not exist or is not in ACTIVE status: ${identifier}`,
);

export const OverlappingFiscalYearError = createDomainError(
  "OverlappingFiscalYearError", "FINANCE_LEDGER_OVERLAPPING_FISCAL_YEAR",
  (identifier: string) => `The date range overlaps with an existing fiscal year for the same company: ${identifier}`,
);

export const InvalidJournalTypeError = createDomainError(
  "InvalidJournalTypeError", "FINANCE_LEDGER_INVALID_JOURNAL_TYPE",
  (identifier: string) => `Journal type is not one of the recognized values (Sales, Purchase, Cash, Bank, Miscellaneous, Opening): ${identifier}`,
);

export const DuplicateReferenceNumberError = createDomainError(
  "DuplicateReferenceNumberError", "FINANCE_LEDGER_DUPLICATE_REFERENCE_NUMBER",
  (identifier: string) => `A journal entry with the same reference number already exists within the company: ${identifier}`,
);

export const InvalidEntryDateError = createDomainError(
  "InvalidEntryDateError", "FINANCE_LEDGER_INVALID_ENTRY_DATE",
  (identifier: string) => `Entry date is not a valid date: ${identifier}`,
);

export const HasAssociatedJournalEntriesError = createDomainError(
  "HasAssociatedJournalEntriesError", "FINANCE_LEDGER_HAS_ASSOCIATED_JOURNAL_ENTRIES",
  (identifier: string) => `Accounting period has one or more journal entries and cannot be deleted: ${identifier}`,
);

export const HasActivePeriodCloseError = createDomainError(
  "HasActivePeriodCloseError", "FINANCE_LEDGER_HAS_ACTIVE_PERIOD_CLOSE",
  (identifier: string) => `Accounting period has an active period close record in progress: ${identifier}`,
);

export const HasAssociatedPeriodsError = createDomainError(
  "HasAssociatedPeriodsError", "FINANCE_LEDGER_HAS_ASSOCIATED_PERIODS",
  (identifier: string) => `Fiscal year has one or more accounting periods and cannot be deleted: ${identifier}`,
);

export const InvalidStatusForDeleteError = createDomainError(
  "InvalidStatusForDeleteError", "FINANCE_LEDGER_INVALID_STATUS_FOR_DELETE",
  (identifier: string) => `Journal entry is not in DRAFT status; POSTED and REVERSED entries cannot be deleted: ${identifier}`,
);

export const NotFinalPeriodError = createDomainError(
  "NotFinalPeriodError", "FINANCE_LEDGER_NOT_FINAL_PERIOD",
  (identifier: string) => `The specified period is not the final period of its fiscal year: ${identifier}`,
);

export const StandardCloseNotCompleteError = createDomainError(
  "StandardCloseNotCompleteError", "FINANCE_LEDGER_STANDARD_CLOSE_NOT_COMPLETE",
  (identifier: string) => `The final period's standard close checklist has not been completed through soft-lock or permanent close: ${identifier}`,
);

export const DuplicateYearEndCloseError = createDomainError(
  "DuplicateYearEndCloseError", "FINANCE_LEDGER_DUPLICATE_YEAR_END_CLOSE",
  (identifier: string) => `Year-end close has already been executed for this fiscal year: ${identifier}`,
);

export const RetainedEarningsAccountNotFoundError = createDomainError(
  "RetainedEarningsAccountNotFoundError", "FINANCE_LEDGER_RETAINED_EARNINGS_ACCOUNT_NOT_FOUND",
  (identifier: string) => `No account with RETAINED_EARNINGS operational classification exists in the active CoA: ${identifier}`,
);

export const NewFiscalYearNotDefinedError = createDomainError(
  "NewFiscalYearNotDefinedError", "FINANCE_LEDGER_NEW_FISCAL_YEAR_NOT_DEFINED",
  (identifier: string) => `The new fiscal year has not been defined; opening balance entries cannot be generated: ${identifier}`,
);

export const FinancialStatementNotFoundError = createDomainError(
  "FinancialStatementNotFoundError", "FINANCE_LEDGER_FINANCIAL_STATEMENT_NOT_FOUND",
  (identifier: string) => `No financial statement matches the given id: ${identifier}`,
);

export const ChartOfAccountsNotFoundError = createDomainError(
  "ChartOfAccountsNotFoundError", "FINANCE_LEDGER_CHART_OF_ACCOUNTS_NOT_FOUND",
  (identifier: string) => `Referenced CoA does not exist or is not ACTIVE: ${identifier}`,
);

export const InvalidStatementTypeError = createDomainError(
  "InvalidStatementTypeError", "FINANCE_LEDGER_INVALID_STATEMENT_TYPE",
  (identifier: string) => `Statement type is not BALANCE_SHEET, PROFIT_AND_LOSS, or CASH_FLOW: ${identifier}`,
);

export const InvalidReportingParametersError = createDomainError(
  "InvalidReportingParametersError", "FINANCE_LEDGER_INVALID_REPORTING_PARAMETERS",
  (identifier: string) => `Missing or invalid reporting date, date range, or cash flow method: ${identifier}`,
);

export const NoTrialBalanceDataError = createDomainError(
  "NoTrialBalanceDataError", "FINANCE_LEDGER_NO_TRIAL_BALANCE_DATA",
  (identifier: string) => `No trial balance data exists for the requested period: ${identifier}`,
);

export const ComparativeDataUnavailableError = createDomainError(
  "ComparativeDataUnavailableError", "FINANCE_LEDGER_COMPARATIVE_DATA_UNAVAILABLE",
  (identifier: string) => `Comparative period trial balance data is not available: ${identifier}`,
);

export const TrialBalanceNotFoundError = createDomainError(
  "TrialBalanceNotFoundError", "FINANCE_LEDGER_TRIAL_BALANCE_NOT_FOUND",
  (identifier: string) => `The verified trial balance for the period no longer exists or is invalid: ${identifier}`,
);

export const NoActiveChartOfAccountsError = createDomainError(
  "NoActiveChartOfAccountsError", "FINANCE_LEDGER_NO_ACTIVE_CHART_OF_ACCOUNTS",
  (identifier: string) => `Company does not have an ACTIVE Chart of Accounts: ${identifier}`,
);

export const TrialBalanceImbalancedError = createDomainError(
  "TrialBalanceImbalancedError", "FINANCE_LEDGER_TRIAL_BALANCE_IMBALANCED",
  (identifier: string) => `Total debits do not equal total credits; includes discrepancy amount: ${identifier}`,
);

export const InvalidVariantError = createDomainError(
  "InvalidVariantError", "FINANCE_LEDGER_INVALID_VARIANT",
  (identifier: string) => `Variant is not PRE_CLOSE or POST_CLOSE: ${identifier}`,
);

export const InvalidPeriodStatusError = createDomainError(
  "InvalidPeriodStatusError", "FINANCE_LEDGER_INVALID_PERIOD_STATUS",
  (identifier: string) => `Accounting period is not in OPEN status: ${identifier}`,
);

export const CloseAlreadyInProgressError = createDomainError(
  "CloseAlreadyInProgressError", "FINANCE_LEDGER_CLOSE_ALREADY_IN_PROGRESS",
  (identifier: string) => `An active PeriodClose record already exists for this period: ${identifier}`,
);

export const ConcurrentCloseConflictError = createDomainError(
  "ConcurrentCloseConflictError", "FINANCE_LEDGER_CONCURRENT_CLOSE_CONFLICT",
  (identifier: string) => `A concurrent close attempt for the same period was detected: ${identifier}`,
);

export const InvalidAdjustingEntryTypeError = createDomainError(
  "InvalidAdjustingEntryTypeError", "FINANCE_LEDGER_INVALID_ADJUSTING_ENTRY_TYPE",
  (identifier: string) => `Adjusting entry type is not ACCRUAL, DEFERRAL, or RECLASSIFICATION: ${identifier}`,
);

export const UnbalancedAdjustingEntriesError = createDomainError(
  "UnbalancedAdjustingEntriesError", "FINANCE_LEDGER_UNBALANCED_ADJUSTING_ENTRIES",
  (identifier: string) => `One or more adjusting entries have total debits not equal to total credits: ${identifier}`,
);

export const InvalidStatusForPostingError = createDomainError(
  "InvalidStatusForPostingError", "FINANCE_LEDGER_INVALID_STATUS_FOR_POSTING",
  (identifier: string) => `Journal entry is not in DRAFT status; only DRAFT entries can be posted: ${identifier}`,
);

export const MinimumLinesNotMetError = createDomainError(
  "MinimumLinesNotMetError", "FINANCE_LEDGER_MINIMUM_LINES_NOT_MET",
  (identifier: string) => `Journal entry has fewer than two journal lines: ${identifier}`,
);

export const UnbalancedEntryError = createDomainError(
  "UnbalancedEntryError", "FINANCE_LEDGER_UNBALANCED_ENTRY",
  (identifier: string) => `Total debits do not equal total credits in the functional currency: ${identifier}`,
);

export const InactiveAccountError = createDomainError(
  "InactiveAccountError", "FINANCE_LEDGER_INACTIVE_ACCOUNT",
  (identifier: string) => `A referenced GL account is inactive or in draft status with no successor mapping: ${identifier}`,
);

export const SuccessorAccountInvalidError = createDomainError(
  "SuccessorAccountInvalidError", "FINANCE_LEDGER_SUCCESSOR_ACCOUNT_INVALID",
  (identifier: string) => `A successor account is itself inactive or deprecated without a further successor: ${identifier}`,
);

export const AccountNotActiveError = createDomainError(
  "AccountNotActiveError", "FINANCE_LEDGER_ACCOUNT_NOT_ACTIVE",
  (identifier: string) => `Referenced GL account is not in active status: ${identifier}`,
);

export const InvalidAmountError = createDomainError(
  "InvalidAmountError", "FINANCE_LEDGER_INVALID_AMOUNT",
  (identifier: string) => `Handoff event contains zero or negative amounts: ${identifier}`,
);

export const CompanyMismatchError = createDomainError(
  "CompanyMismatchError", "FINANCE_LEDGER_COMPANY_MISMATCH",
  (identifier: string) => `Handoff event company does not match the GL account company scope: ${identifier}`,
);

export const StatementAlreadyFinalizedError = createDomainError(
  "StatementAlreadyFinalizedError", "FINANCE_LEDGER_STATEMENT_ALREADY_FINALIZED",
  (identifier: string) => `Financial statement is in FINALIZED status and cannot be regenerated: ${identifier}`,
);

export const ComparativeTrialBalanceNotFoundError = createDomainError(
  "ComparativeTrialBalanceNotFoundError", "FINANCE_LEDGER_COMPARATIVE_TRIAL_BALANCE_NOT_FOUND",
  (identifier: string) => `Comparative period trial balance is unavailable when requested: ${identifier}`,
);

export const JournalLineNotFoundError = createDomainError(
  "JournalLineNotFoundError", "FINANCE_LEDGER_JOURNAL_LINE_NOT_FOUND",
  (identifier: string) => `Referenced journal line does not exist: ${identifier}`,
);

export const InvalidStatusForLineRemoveError = createDomainError(
  "InvalidStatusForLineRemoveError", "FINANCE_LEDGER_INVALID_STATUS_FOR_LINE_REMOVE",
  (identifier: string) => `Parent journal entry is not in DRAFT status: ${identifier}`,
);

export const InvalidStatusForReversalError = createDomainError(
  "InvalidStatusForReversalError", "FINANCE_LEDGER_INVALID_STATUS_FOR_REVERSAL",
  (identifier: string) => `Journal entry is not in POSTED status; only POSTED entries can be reversed: ${identifier}`,
);

export const AlreadyReversedError = createDomainError(
  "AlreadyReversedError", "FINANCE_LEDGER_ALREADY_REVERSED",
  (identifier: string) => `Journal entry has already been reversed: ${identifier}`,
);

export const PeriodPermanentlyClosedError = createDomainError(
  "PeriodPermanentlyClosedError", "FINANCE_LEDGER_PERIOD_PERMANENTLY_CLOSED",
  (identifier: string) => `Cannot revert a period close that has already been permanently closed: ${identifier}`,
);

export const DatesImmutableError = createDomainError(
  "DatesImmutableError", "FINANCE_LEDGER_DATES_IMMUTABLE",
  (identifier: string) => `Attempting to change start/end dates after accounting periods exist: ${identifier}`,
);

export const InvalidStatusForUpdateError = createDomainError(
  "InvalidStatusForUpdateError", "FINANCE_LEDGER_INVALID_STATUS_FOR_UPDATE",
  (identifier: string) => `Journal entry is not in DRAFT status; POSTED and REVERSED entries cannot be modified: ${identifier}`,
);

export const JournalTypeImmutableError = createDomainError(
  "JournalTypeImmutableError", "FINANCE_LEDGER_JOURNAL_TYPE_IMMUTABLE",
  (identifier: string) => `Attempted to change the journal type after creation; journal type is immutable once created: ${identifier}`,
);

export const InvalidStatusForLineUpdateError = createDomainError(
  "InvalidStatusForLineUpdateError", "FINANCE_LEDGER_INVALID_STATUS_FOR_LINE_UPDATE",
  (identifier: string) => `Parent journal entry is not in DRAFT status: ${identifier}`,
);

export const PendingSubledgerTransactionsError = createDomainError(
  "PendingSubledgerTransactionsError", "FINANCE_LEDGER_PENDING_SUBLEDGER_TRANSACTIONS",
  (identifier: string) => `One or more subledger modules have pending unposted transactions for the period: ${identifier}`,
);

export const PeriodNotFoundError = createDomainError(
  "PeriodNotFoundError", "FINANCE_LEDGER_PERIOD_NOT_FOUND",
  (identifier: string) => `No operating period covers the given date for the specified company — caller receives null: ${identifier}`,
);

export const EmptyResultError = createDomainError(
  "EmptyResultError", "FINANCE_LEDGER_EMPTY_RESULT",
  (identifier: string) => `No accounting periods match the given criteria — returns empty list: ${identifier}`,
);
