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

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

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

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

export const InvalidStatusTransitionError = createDomainError(
  "InvalidStatusTransitionError", "FINANCIAL_ACCOUNTING_INVALID_STATUS_TRANSITION",
  (identifier: string) => `Requested status transition is not allowed from the current status: ${identifier}`,
);

export const FiscalYearNotFoundError = createDomainError(
  "FiscalYearNotFoundError", "FINANCIAL_ACCOUNTING_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", "FINANCIAL_ACCOUNTING_NAME_REQUIRED",
  (identifier: string) => `Name is empty, whitespace-only, or not provided when required: ${identifier}`,
);

export const InvalidDateRangeError = createDomainError(
  "InvalidDateRangeError", "FINANCIAL_ACCOUNTING_INVALID_DATE_RANGE",
  (identifier: string) => `Date range is invalid: ${identifier}`,
);

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

export const DuplicatePeriodDatesError = createDomainError(
  "DuplicatePeriodDatesError", "FINANCIAL_ACCOUNTING_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", "FINANCIAL_ACCOUNTING_COMPANY_NOT_FOUND",
  (identifier: string) => `Referenced company does not exist: ${identifier}`,
);

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

export const AccountingPeriodCompanyMismatchError = createDomainError(
  "AccountingPeriodCompanyMismatchError", "FINANCIAL_ACCOUNTING_ACCOUNTING_PERIOD_COMPANY_MISMATCH",
  (identifier: string) => `Accounting period belongs to a different company: ${identifier}`,
);

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

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

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

export const AccountInactiveError = createDomainError(
  "AccountInactiveError", "FINANCIAL_ACCOUNTING_ACCOUNT_INACTIVE",
  (identifier: string) => `Referenced GL account is not ACTIVE: ${identifier}`,
);

export const InvalidDebitCreditError = createDomainError(
  "InvalidDebitCreditError", "FINANCIAL_ACCOUNTING_INVALID_DEBIT_CREDIT",
  (identifier: string) => `Debit/credit values violate constraints: ${identifier}`,
);

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

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

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

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

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

export const InvalidStatusForReversalError = createDomainError(
  "InvalidStatusForReversalError", "FINANCIAL_ACCOUNTING_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", "FINANCIAL_ACCOUNTING_ALREADY_REVERSED",
  (identifier: string) => `Journal entry has already been reversed: ${identifier}`,
);

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

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

export const EmptyJournalEntryChangesError = createDomainError(
  "EmptyJournalEntryChangesError", "FINANCIAL_ACCOUNTING_EMPTY_JOURNAL_ENTRY_CHANGES",
  (identifier: string) => `Update contains no header or line changes: ${identifier}`,
);

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

export const ScopeRequiredError = createDomainError(
  "ScopeRequiredError", "FINANCIAL_ACCOUNTING_SCOPE_REQUIRED",
  (identifier: string) => `A companyId or fiscalYearId scope is required: ${identifier}`,
);
