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

export const PaymentTermNotFoundError = createDomainError(
  "PaymentTermNotFoundError", "PURCHASE_PAYMENT_TERM_NOT_FOUND",
  (identifier: string) => `Target payment term does not exist: ${identifier}`,
);

export const InvalidTermConfigurationError = createDomainError(
  "InvalidTermConfigurationError", "PURCHASE_INVALID_TERM_CONFIGURATION",
  (identifier: string) => `Term definition is no longer valid for activation: ${identifier}`,
);

export const PriceListNotFoundError = createDomainError(
  "PriceListNotFoundError", "PURCHASE_PRICE_LIST_NOT_FOUND",
  (identifier: string) => `Target price list does not exist: ${identifier}`,
);

export const PriceRuleNotFoundError = createDomainError(
  "PriceRuleNotFoundError", "PURCHASE_PRICE_RULE_NOT_FOUND",
  (identifier: string) => `Target price rule does not exist: ${identifier}`,
);

export const DuplicateRulePrecedenceError = createDomainError(
  "DuplicateRulePrecedenceError", "PURCHASE_DUPLICATE_RULE_PRECEDENCE",
  (identifier: string) => `Another active rule already owns the same precedence context: ${identifier}`,
);

export const InvalidRuleConfigurationError = createDomainError(
  "InvalidRuleConfigurationError", "PURCHASE_INVALID_RULE_CONFIGURATION",
  (identifier: string) => `Rule references or dates are no longer valid for activation: ${identifier}`,
);

export const PurchaseOrderNotFoundError = createDomainError(
  "PurchaseOrderNotFoundError", "PURCHASE_PURCHASE_ORDER_NOT_FOUND",
  (identifier: string) => `Target purchase order does not exist: ${identifier}`,
);

export const PurchaseOrderNotSubmittedError = createDomainError(
  "PurchaseOrderNotSubmittedError", "PURCHASE_PURCHASE_ORDER_NOT_SUBMITTED",
  (identifier: string) => `Purchase order is not in SUBMITTED status: ${identifier}`,
);

export const SupplierNotActiveError = createDomainError(
  "SupplierNotActiveError", "PURCHASE_SUPPLIER_NOT_ACTIVE",
  (identifier: string) => `Supplier is inactive at approval time: ${identifier}`,
);

export const PartnerNotSupplierError = createDomainError(
  "PartnerNotSupplierError", "PURCHASE_PARTNER_NOT_SUPPLIER",
  (identifier: string) => `Supplier no longer carries the SUPPLIER role: ${identifier}`,
);

export const ItemNotActiveError = createDomainError(
  "ItemNotActiveError", "PURCHASE_ITEM_NOT_ACTIVE",
  (identifier: string) => `One or more referenced items are inactive: ${identifier}`,
);

export const MissingCommercialSnapshotError = createDomainError(
  "MissingCommercialSnapshotError", "PURCHASE_MISSING_COMMERCIAL_SNAPSHOT",
  (identifier: string) => `Required payment-term or price snapshot data is missing: ${identifier}`,
);

export const GoodsReceiptNotFoundError = createDomainError(
  "GoodsReceiptNotFoundError", "PURCHASE_GOODS_RECEIPT_NOT_FOUND",
  (identifier: string) => `Target goods receipt does not exist: ${identifier}`,
);

export const GoodsReceiptNotDraftError = createDomainError(
  "GoodsReceiptNotDraftError", "PURCHASE_GOODS_RECEIPT_NOT_DRAFT",
  (identifier: string) => `Goods receipt is not in DRAFT status: ${identifier}`,
);

export const PurchaseBillNotFoundError = createDomainError(
  "PurchaseBillNotFoundError", "PURCHASE_PURCHASE_BILL_NOT_FOUND",
  (identifier: string) => `Target purchase bill does not exist: ${identifier}`,
);

export const PurchaseBillNotCancellableError = createDomainError(
  "PurchaseBillNotCancellableError", "PURCHASE_PURCHASE_BILL_NOT_CANCELLABLE",
  (identifier: string) => `Purchase bill status does not allow cancellation: ${identifier}`,
);

export const DownstreamHandoffAcceptedError = createDomainError(
  "DownstreamHandoffAcceptedError", "PURCHASE_DOWNSTREAM_HANDOFF_ACCEPTED",
  (identifier: string) => `Downstream AP or accounting already accepted the bill-ready handoff: ${identifier}`,
);

export const PurchaseOrderNotCancellableError = createDomainError(
  "PurchaseOrderNotCancellableError", "PURCHASE_PURCHASE_ORDER_NOT_CANCELLABLE",
  (identifier: string) => `Purchase order status does not allow cancellation: ${identifier}`,
);

export const PurchaseOrderAlreadyFulfilledError = createDomainError(
  "PurchaseOrderAlreadyFulfilledError", "PURCHASE_PURCHASE_ORDER_ALREADY_FULFILLED",
  (identifier: string) => `Posted receipts or matched bills already exist against the order: ${identifier}`,
);

export const PurchaseOrderNotClosableError = createDomainError(
  "PurchaseOrderNotClosableError", "PURCHASE_PURCHASE_ORDER_NOT_CLOSABLE",
  (identifier: string) => `Purchase order status does not allow closure: ${identifier}`,
);

export const OpenQuantityRemainsError = createDomainError(
  "OpenQuantityRemainsError", "PURCHASE_OPEN_QUANTITY_REMAINS",
  (identifier: string) => `Remaining quantity is not fulfilled or explicitly written off: ${identifier}`,
);

export const CloseReasonRequiredError = createDomainError(
  "CloseReasonRequiredError", "PURCHASE_CLOSE_REASON_REQUIRED",
  (identifier: string) => `Residual open quantity exists but no write-off reason was provided: ${identifier}`,
);

export const PurchaseOrderNotReceivableError = createDomainError(
  "PurchaseOrderNotReceivableError", "PURCHASE_PURCHASE_ORDER_NOT_RECEIVABLE",
  (identifier: string) => `Purchase order is cancelled, closed, or otherwise unavailable for receipt: ${identifier}`,
);

export const EmptyReceiptLinesError = createDomainError(
  "EmptyReceiptLinesError", "PURCHASE_EMPTY_RECEIPT_LINES",
  (identifier: string) => `No goods-receipt lines were provided: ${identifier}`,
);

export const PurchaseOrderLineNotFoundError = createDomainError(
  "PurchaseOrderLineNotFoundError", "PURCHASE_PURCHASE_ORDER_LINE_NOT_FOUND",
  (identifier: string) => `Referenced purchase-order line does not exist: ${identifier}`,
);

export const NoOpenReceiptQuantityError = createDomainError(
  "NoOpenReceiptQuantityError", "PURCHASE_NO_OPEN_RECEIPT_QUANTITY",
  (identifier: string) => `Purchase-order line has no remaining open quantity to receive: ${identifier}`,
);

export const InvalidReceivedQuantityError = createDomainError(
  "InvalidReceivedQuantityError", "PURCHASE_INVALID_RECEIVED_QUANTITY",
  (identifier: string) => `Received quantity is zero or negative: ${identifier}`,
);

export const CompanyScopeMismatchError = createDomainError(
  "CompanyScopeMismatchError", "PURCHASE_COMPANY_SCOPE_MISMATCH",
  (identifier: string) => `Goods receipt company does not match the purchase order company: ${identifier}`,
);

export const SupplierNotFoundError = createDomainError(
  "SupplierNotFoundError", "PURCHASE_SUPPLIER_NOT_FOUND",
  (identifier: string) => `Referenced supplier does not exist: ${identifier}`,
);

export const DuplicateSupplierInvoiceNumberError = createDomainError(
  "DuplicateSupplierInvoiceNumberError", "PURCHASE_DUPLICATE_SUPPLIER_INVOICE_NUMBER",
  (identifier: string) => `Supplier invoice number already exists in the same company and supplier scope: ${identifier}`,
);

export const EmptyBillLinesError = createDomainError(
  "EmptyBillLinesError", "PURCHASE_EMPTY_BILL_LINES",
  (identifier: string) => `No purchase-bill lines were provided: ${identifier}`,
);

export const InvalidBilledQuantityError = createDomainError(
  "InvalidBilledQuantityError", "PURCHASE_INVALID_BILLED_QUANTITY",
  (identifier: string) => `Billed quantity is zero or negative: ${identifier}`,
);

export const PurchaseOrderCancelledError = createDomainError(
  "PurchaseOrderCancelledError", "PURCHASE_PURCHASE_ORDER_CANCELLED",
  (identifier: string) => `Referenced purchase order is cancelled: ${identifier}`,
);

export const PaymentTermSnapshotMissingError = createDomainError(
  "PaymentTermSnapshotMissingError", "PURCHASE_PAYMENT_TERM_SNAPSHOT_MISSING",
  (identifier: string) => `No valid payment-term snapshot is available for the bill: ${identifier}`,
);

export const SupplierTaxIdentificationMissingError = createDomainError(
  "SupplierTaxIdentificationMissingError", "PURCHASE_SUPPLIER_TAX_IDENTIFICATION_MISSING",
  (identifier: string) => `Required supplier tax identification cannot be snapshotted: ${identifier}`,
);

export const EmptyPurchaseOrderLinesError = createDomainError(
  "EmptyPurchaseOrderLinesError", "PURCHASE_EMPTY_PURCHASE_ORDER_LINES",
  (identifier: string) => `No purchase-order lines were provided: ${identifier}`,
);

export const ItemNotFoundError = createDomainError(
  "ItemNotFoundError", "PURCHASE_ITEM_NOT_FOUND",
  (identifier: string) => `Referenced item does not exist: ${identifier}`,
);

export const InvalidQuantityError = createDomainError(
  "InvalidQuantityError", "PURCHASE_INVALID_QUANTITY",
  (identifier: string) => `Ordered quantity is zero or negative: ${identifier}`,
);

export const InvalidUnitPriceError = createDomainError(
  "InvalidUnitPriceError", "PURCHASE_INVALID_UNIT_PRICE",
  (identifier: string) => `Unit price is negative: ${identifier}`,
);

export const ReceivingSiteNotFoundError = createDomainError(
  "ReceivingSiteNotFoundError", "PURCHASE_RECEIVING_SITE_NOT_FOUND",
  (identifier: string) => `Referenced receiving site does not exist: ${identifier}`,
);

export const ReceivingSiteRequiredError = createDomainError(
  "ReceivingSiteRequiredError", "PURCHASE_RECEIVING_SITE_REQUIRED",
  (identifier: string) => `A physical-receipt line has no receiving site: ${identifier}`,
);

export const PaymentTermInactiveError = createDomainError(
  "PaymentTermInactiveError", "PURCHASE_PAYMENT_TERM_INACTIVE",
  (identifier: string) => `Inherited default payment term is inactive: ${identifier}`,
);

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

export const EmptyScheduleError = createDomainError(
  "EmptyScheduleError", "PURCHASE_EMPTY_SCHEDULE",
  (identifier: string) => `No payment term schedule lines were provided: ${identifier}`,
);

export const InvalidInstallmentTotalError = createDomainError(
  "InvalidInstallmentTotalError", "PURCHASE_INVALID_INSTALLMENT_TOTAL",
  (identifier: string) => `Percentage-based installment lines do not total 100 percent: ${identifier}`,
);

export const InvalidScheduleLineError = createDomainError(
  "InvalidScheduleLineError", "PURCHASE_INVALID_SCHEDULE_LINE",
  (identifier: string) => `A schedule line contains a negative percentage or negative fixed amount: ${identifier}`,
);

export const InvalidDiscountConfigurationError = createDomainError(
  "InvalidDiscountConfigurationError", "PURCHASE_INVALID_DISCOUNT_CONFIGURATION",
  (identifier: string) => `Discount metadata is incomplete or inconsistent with the final due date: ${identifier}`,
);

export const InvalidListPriorityError = createDomainError(
  "InvalidListPriorityError", "PURCHASE_INVALID_LIST_PRIORITY",
  (identifier: string) => `List priority conflicts with deterministic supplier ordering rules: ${identifier}`,
);

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

export const UnitNotFoundError = createDomainError(
  "UnitNotFoundError", "PURCHASE_UNIT_NOT_FOUND",
  (identifier: string) => `Referenced purchase unit does not exist: ${identifier}`,
);

export const InvalidMinimumQuantityError = createDomainError(
  "InvalidMinimumQuantityError", "PURCHASE_INVALID_MINIMUM_QUANTITY",
  (identifier: string) => `Minimum quantity is negative: ${identifier}`,
);

export const InvalidEffectiveRangeError = createDomainError(
  "InvalidEffectiveRangeError", "PURCHASE_INVALID_EFFECTIVE_RANGE",
  (identifier: string) => `Effective end date is earlier than effective start date: ${identifier}`,
);

export const PaymentTermInUseError = createDomainError(
  "PaymentTermInUseError", "PURCHASE_PAYMENT_TERM_IN_USE",
  (identifier: string) => `Payment term is still configured as an active supplier default: ${identifier}`,
);

export const PurchaseBillNotDraftError = createDomainError(
  "PurchaseBillNotDraftError", "PURCHASE_PURCHASE_BILL_NOT_DRAFT",
  (identifier: string) => `Purchase bill is not in DRAFT status: ${identifier}`,
);

export const MatchModeRequiredError = createDomainError(
  "MatchModeRequiredError", "PURCHASE_MATCH_MODE_REQUIRED",
  (identifier: string) => `No matching mode was provided: ${identifier}`,
);

export const ReceiptQuantityExceededError = createDomainError(
  "ReceiptQuantityExceededError", "PURCHASE_RECEIPT_QUANTITY_EXCEEDED",
  (identifier: string) => `Billed quantity exceeds posted receipt quantity beyond tolerance in 3-way mode: ${identifier}`,
);

export const PriceVarianceExceededError = createDomainError(
  "PriceVarianceExceededError", "PURCHASE_PRICE_VARIANCE_EXCEEDED",
  (identifier: string) => `Billed price exceeds allowed variance tolerance: ${identifier}`,
);

export const PaymentScheduleCalculationFailedError = createDomainError(
  "PaymentScheduleCalculationFailedError", "PURCHASE_PAYMENT_SCHEDULE_CALCULATION_FAILED",
  (identifier: string) => `Due schedule could not be derived from the payment-term snapshot: ${identifier}`,
);

export const OverReceiptToleranceExceededError = createDomainError(
  "OverReceiptToleranceExceededError", "PURCHASE_OVER_RECEIPT_TOLERANCE_EXCEEDED",
  (identifier: string) => `Received quantity exceeds allowed tolerance: ${identifier}`,
);

export const InactiveExecutionReferenceError = createDomainError(
  "InactiveExecutionReferenceError", "PURCHASE_INACTIVE_EXECUTION_REFERENCE",
  (identifier: string) => `Supplier or item is no longer valid for execution: ${identifier}`,
);

export const InventoryHandoffFailedError = createDomainError(
  "InventoryHandoffFailedError", "PURCHASE_INVENTORY_HANDOFF_FAILED",
  (identifier: string) => `Downstream inventory handoff could not be recorded: ${identifier}`,
);

export const RejectionReasonRequiredError = createDomainError(
  "RejectionReasonRequiredError", "PURCHASE_REJECTION_REASON_REQUIRED",
  (identifier: string) => `No rejection reason was provided: ${identifier}`,
);

export const PurchaseBillNotBlockedError = createDomainError(
  "PurchaseBillNotBlockedError", "PURCHASE_PURCHASE_BILL_NOT_BLOCKED",
  (identifier: string) => `Purchase bill is not in BLOCKED status: ${identifier}`,
);

export const ReleaseReasonRequiredError = createDomainError(
  "ReleaseReasonRequiredError", "PURCHASE_RELEASE_REASON_REQUIRED",
  (identifier: string) => `No override or resolution reason was provided: ${identifier}`,
);

export const PurchaseOrderNotDraftError = createDomainError(
  "PurchaseOrderNotDraftError", "PURCHASE_PURCHASE_ORDER_NOT_DRAFT",
  (identifier: string) => `Purchase order is not in DRAFT status: ${identifier}`,
);

export const DuplicateExternalSupplierOrderReferenceError = createDomainError(
  "DuplicateExternalSupplierOrderReferenceError", "PURCHASE_DUPLICATE_EXTERNAL_SUPPLIER_ORDER_REFERENCE",
  (identifier: string) => `Another order already uses the same external supplier order reference in the company: ${identifier}`,
);

export const ImmutableCompanyScopeError = createDomainError(
  "ImmutableCompanyScopeError", "PURCHASE_IMMUTABLE_COMPANY_SCOPE",
  (identifier: string) => `Update attempted to move the term into another company: ${identifier}`,
);

export const ImmutableOwnerChangeError = createDomainError(
  "ImmutableOwnerChangeError", "PURCHASE_IMMUTABLE_OWNER_CHANGE",
  (identifier: string) => `Update attempted to change the supplier or company owner: ${identifier}`,
);

export const InvalidPaymentTermConfigurationError = createDomainError(
  "InvalidPaymentTermConfigurationError", "PURCHASE_INVALID_PAYMENT_TERM_CONFIGURATION",
  (identifier: string) => `Payment term schedule is incomplete or internally inconsistent: ${identifier}`,
);

export const InvalidBillAmountError = createDomainError(
  "InvalidBillAmountError", "PURCHASE_INVALID_BILL_AMOUNT",
  (identifier: string) => `Bill amount input is negative or incompatible with the schedule type: ${identifier}`,
);

export const IncompatibleUnitsError = createDomainError(
  "IncompatibleUnitsError", "PURCHASE_INCOMPATIBLE_UNITS",
  (identifier: string) => `Quantity-break comparison requires units that do not share a conversion path: ${identifier}`,
);

export const NoMatchingPriceRuleError = createDomainError(
  "NoMatchingPriceRuleError", "PURCHASE_NO_MATCHING_PRICE_RULE",
  (identifier: string) => `No active rule matches; caller receives null suggestion: ${identifier}`,
);

export const SupplierProfileNotFoundError = createDomainError(
  "SupplierProfileNotFoundError", "PURCHASE_SUPPLIER_PROFILE_NOT_FOUND",
  (identifier: string) => `No supplier profile exists for the given company and supplier; caller receives null: ${identifier}`,
);
