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

export const ApDocumentNotFoundError = createDomainError(
  "ApDocumentNotFoundError", "ACCOUNT_PAYABLE_AP_DOCUMENT_NOT_FOUND",
  (identifier: string) => `Referenced AP document does not exist: ${identifier}`,
);

export const ApInvalidDocumentStatusError = createDomainError(
  "ApInvalidDocumentStatusError", "ACCOUNT_PAYABLE_AP_INVALID_DOCUMENT_STATUS",
  (identifier: string) => `AP document status does not allow this operation: ${identifier}`,
);

export const ApPurchaseOrderBillingSyncFailedError = createDomainError(
  "ApPurchaseOrderBillingSyncFailedError", "ACCOUNT_PAYABLE_AP_PURCHASE_ORDER_BILLING_SYNC_FAILED",
  (identifier: string) => `Purchase-order billing status sync failed for the AP document: ${identifier}`,
);

export const CompanyNotFoundError = createDomainError(
  "CompanyNotFoundError", "ACCOUNT_PAYABLE_COMPANY_NOT_FOUND",
  (identifier: string) => `Referenced company does not exist: ${identifier}`,
);

export const ApBusinessPartnerNotFoundError = createDomainError(
  "ApBusinessPartnerNotFoundError", "ACCOUNT_PAYABLE_AP_BUSINESS_PARTNER_NOT_FOUND",
  (identifier: string) => `Referenced business partner does not exist: ${identifier}`,
);

export const ApCurrencyNotFoundError = createDomainError(
  "ApCurrencyNotFoundError", "ACCOUNT_PAYABLE_AP_CURRENCY_NOT_FOUND",
  (identifier: string) => `Referenced currency does not exist: ${identifier}`,
);

export const ApMinimumLinesNotMetError = createDomainError(
  "ApMinimumLinesNotMetError", "ACCOUNT_PAYABLE_AP_MINIMUM_LINES_NOT_MET",
  (identifier: string) => `AP document must have at least one line and one distribution: ${identifier}`,
);

export const ApInvalidAmountError = createDomainError(
  "ApInvalidAmountError", "ACCOUNT_PAYABLE_AP_INVALID_AMOUNT",
  (identifier: string) => `AP document or line amount must be positive: ${identifier}`,
);

export const ApLineTotalMismatchError = createDomainError(
  "ApLineTotalMismatchError", "ACCOUNT_PAYABLE_AP_LINE_TOTAL_MISMATCH",
  (identifier: string) => `AP line gross total or distribution total does not match the document total: ${identifier}`,
);

export const ApLineSourceInconsistentError = createDomainError(
  "ApLineSourceInconsistentError", "ACCOUNT_PAYABLE_AP_LINE_SOURCE_INCONSISTENT",
  (identifier: string) => `AP line source type, purchase order line, quantity, unit price, and unit are not consistent: ${identifier}`,
);

export const ApLineAmountMismatchError = createDomainError(
  "ApLineAmountMismatchError", "ACCOUNT_PAYABLE_AP_LINE_AMOUNT_MISMATCH",
  (identifier: string) => `AP line net amount does not equal quantity times unit price: ${identifier}`,
);

export const ApDueScheduleInvalidError = createDomainError(
  "ApDueScheduleInvalidError", "ACCOUNT_PAYABLE_AP_DUE_SCHEDULE_INVALID",
  (identifier: string) => `AP due schedule must have positive amounts and sum to the document total: ${identifier}`,
);

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

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

export const InvalidToleranceValueError = createDomainError(
  "InvalidToleranceValueError", "ACCOUNT_PAYABLE_INVALID_TOLERANCE_VALUE",
  (identifier: string) => `Invoice tolerance value must not be negative: ${identifier}`,
);

export const InvoiceToleranceConfigAlreadyExistsError = createDomainError(
  "InvoiceToleranceConfigAlreadyExistsError", "ACCOUNT_PAYABLE_INVOICE_TOLERANCE_CONFIG_ALREADY_EXISTS",
  (identifier: string) => `Invoice tolerance config already exists for the company and supplier: ${identifier}`,
);

export const ApDocumentHasActiveHoldError = createDomainError(
  "ApDocumentHasActiveHoldError", "ACCOUNT_PAYABLE_AP_DOCUMENT_HAS_ACTIVE_HOLD",
  (identifier: string) => `AP document cannot be posted while it has an active payment hold: ${identifier}`,
);

export const ApAccountingEventPostFailedError = createDomainError(
  "ApAccountingEventPostFailedError", "ACCOUNT_PAYABLE_AP_ACCOUNTING_EVENT_POST_FAILED",
  (identifier: string) => `Accounting event posting failed for the AP document: ${identifier}`,
);

export const ApHoldNotFoundError = createDomainError(
  "ApHoldNotFoundError", "ACCOUNT_PAYABLE_AP_HOLD_NOT_FOUND",
  (identifier: string) => `Referenced AP document hold does not exist: ${identifier}`,
);

export const ApHoldAlreadyReleasedError = createDomainError(
  "ApHoldAlreadyReleasedError", "ACCOUNT_PAYABLE_AP_HOLD_ALREADY_RELEASED",
  (identifier: string) => `AP document hold is already released: ${identifier}`,
);

export const ApDocumentLineNotFoundError = createDomainError(
  "ApDocumentLineNotFoundError", "ACCOUNT_PAYABLE_AP_DOCUMENT_LINE_NOT_FOUND",
  (identifier: string) => `Referenced AP document line does not exist: ${identifier}`,
);

export const ApDistributionLineNotFoundError = createDomainError(
  "ApDistributionLineNotFoundError", "ACCOUNT_PAYABLE_AP_DISTRIBUTION_LINE_NOT_FOUND",
  (identifier: string) => `Referenced AP distribution line does not exist: ${identifier}`,
);

export const ApLineEditConflictError = createDomainError(
  "ApLineEditConflictError", "ACCOUNT_PAYABLE_AP_LINE_EDIT_CONFLICT",
  (identifier: string) => `AP document line cannot be updated and removed in the same command: ${identifier}`,
);

export const AccountCompanyMismatchError = createDomainError(
  "AccountCompanyMismatchError", "ACCOUNT_PAYABLE_ACCOUNT_COMPANY_MISMATCH",
  (identifier: string) => `Referenced payable control or distribution GL account belongs to a different company: ${identifier}`,
);

export const InvoiceToleranceConfigNotFoundError = createDomainError(
  "InvoiceToleranceConfigNotFoundError", "ACCOUNT_PAYABLE_INVOICE_TOLERANCE_CONFIG_NOT_FOUND",
  (identifier: string) => `Referenced invoice tolerance config does not exist: ${identifier}`,
);
