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

export const PaymentTermNotFoundError = createDomainError(
  "PaymentTermNotFoundError", "PURCHASE_PAYMENT_TERM_NOT_FOUND",
  (identifier: string) => `Referenced purchase 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) => `Referenced purchase 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 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 PoNotFoundError = createDomainError(
  "PoNotFoundError", "PURCHASE_PO_NOT_FOUND",
  (identifier: string) => `Target purchase order does not exist: ${identifier}`,
);

export const PoNotOrderedError = createDomainError(
  "PoNotOrderedError", "PURCHASE_PO_NOT_ORDERED",
  (identifier: string) => `Purchase order is not in ORDERED status: ${identifier}`,
);

export const EmptyAmendmentChangesError = createDomainError(
  "EmptyAmendmentChangesError", "PURCHASE_EMPTY_AMENDMENT_CHANGES",
  (identifier: string) => `Amendment contains no header or line changes: ${identifier}`,
);

export const ProtectedHeaderFieldError = createDomainError(
  "ProtectedHeaderFieldError", "PURCHASE_PROTECTED_HEADER_FIELD",
  (identifier: string) => `A header change targets a protected field that cannot be amended: ${identifier}`,
);

export const ProtectedLineFieldError = createDomainError(
  "ProtectedLineFieldError", "PURCHASE_PROTECTED_LINE_FIELD",
  (identifier: string) => `A line ADD or MODIFY change targets a protected line field that cannot be amended: ${identifier}`,
);

export const LineNotFoundError = createDomainError(
  "LineNotFoundError", "PURCHASE_LINE_NOT_FOUND",
  (identifier: string) => `Referenced line does not exist on the target order: ${identifier}`,
);

export const ModifyQuantityBelowReceivedError = createDomainError(
  "ModifyQuantityBelowReceivedError", "PURCHASE_MODIFY_QUANTITY_BELOW_RECEIVED",
  (identifier: string) => `MODIFY reduces quantity below the line's non-cancelled received quantity (posted + draft): ${identifier}`,
);

export const ModifyQuantityBelowBilledError = createDomainError(
  "ModifyQuantityBelowBilledError", "PURCHASE_MODIFY_QUANTITY_BELOW_BILLED",
  (identifier: string) => `MODIFY reduces quantity below the line's non-cancelled billed quantity (matched + draft/blocked): ${identifier}`,
);

export const RemoveLineHasReceiptsError = createDomainError(
  "RemoveLineHasReceiptsError", "PURCHASE_REMOVE_LINE_HAS_RECEIPTS",
  (identifier: string) => `REMOVE targets a line with posted receipt quantity: ${identifier}`,
);

export const RemoveLineHasBillsError = createDomainError(
  "RemoveLineHasBillsError", "PURCHASE_REMOVE_LINE_HAS_BILLS",
  (identifier: string) => `REMOVE targets a line with matched bill quantity: ${identifier}`,
);

export const RemoveLineHasDownstreamReferencesError = createDomainError(
  "RemoveLineHasDownstreamReferencesError", "PURCHASE_REMOVE_LINE_HAS_DOWNSTREAM_REFERENCES",
  (identifier: string) => `REMOVE targets a line referenced by draft or blocked downstream documents: ${identifier}`,
);

export const AddInvalidQuantityError = createDomainError(
  "AddInvalidQuantityError", "PURCHASE_ADD_INVALID_QUANTITY",
  (identifier: string) => `ADD action has zero or negative quantity: ${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) => `Quantity is zero or negative: ${identifier}`,
);

export const InvalidUnitPriceError = createDomainError(
  "InvalidUnitPriceError", "PURCHASE_INVALID_UNIT_PRICE",
  (identifier: string) => `Unit price is negative or otherwise invalid: ${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 PurchaseOrderNotFoundError = createDomainError(
  "PurchaseOrderNotFoundError", "PURCHASE_PURCHASE_ORDER_NOT_FOUND",
  (identifier: string) => `Referenced 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) => `Referenced supplier is not in ACTIVE status: ${identifier}`,
);

export const PartnerNotSupplierError = createDomainError(
  "PartnerNotSupplierError", "PURCHASE_PARTNER_NOT_SUPPLIER",
  (identifier: string) => `Referenced partner does not carry the SUPPLIER role: ${identifier}`,
);

export const ItemNotActiveError = createDomainError(
  "ItemNotActiveError", "PURCHASE_ITEM_NOT_ACTIVE",
  (identifier: string) => `Referenced item is not in ACTIVE status: ${identifier}`,
);

export const PurchaseRequisitionNotFoundError = createDomainError(
  "PurchaseRequisitionNotFoundError", "PURCHASE_PURCHASE_REQUISITION_NOT_FOUND",
  (identifier: string) => `Referenced purchase requisition does not exist: ${identifier}`,
);

export const PurchaseRequisitionNotSubmittedError = createDomainError(
  "PurchaseRequisitionNotSubmittedError", "PURCHASE_PURCHASE_REQUISITION_NOT_SUBMITTED",
  (identifier: string) => `Purchase requisition is not in SUBMITTED status: ${identifier}`,
);

export const SelfApprovalNotAllowedError = createDomainError(
  "SelfApprovalNotAllowedError", "PURCHASE_SELF_APPROVAL_NOT_ALLOWED",
  (identifier: string) => `The approver is the same user as the requester: ${identifier}`,
);

export const PurchaseBillNotFoundError = createDomainError(
  "PurchaseBillNotFoundError", "PURCHASE_PURCHASE_BILL_NOT_FOUND",
  (identifier: string) => `Referenced 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 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 PurchaseRequisitionNotCancellableError = createDomainError(
  "PurchaseRequisitionNotCancellableError", "PURCHASE_PURCHASE_REQUISITION_NOT_CANCELLABLE",
  (identifier: string) => `Purchase requisition status does not allow cancellation: ${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 PurchaseRequisitionNotClosableError = createDomainError(
  "PurchaseRequisitionNotClosableError", "PURCHASE_PURCHASE_REQUISITION_NOT_CLOSABLE",
  (identifier: string) => `Purchase requisition status does not allow closure: ${identifier}`,
);

export const PurchaseRequisitionNotApprovedError = createDomainError(
  "PurchaseRequisitionNotApprovedError", "PURCHASE_PURCHASE_REQUISITION_NOT_APPROVED",
  (identifier: string) => `Purchase requisition is not in APPROVED status: ${identifier}`,
);

export const PurchaseRequisitionAlreadyConvertedError = createDomainError(
  "PurchaseRequisitionAlreadyConvertedError", "PURCHASE_PURCHASE_REQUISITION_ALREADY_CONVERTED",
  (identifier: string) => `Purchase requisition has already been converted: ${identifier}`,
);

export const SupplierRequiredError = createDomainError(
  "SupplierRequiredError", "PURCHASE_SUPPLIER_REQUIRED",
  (identifier: string) => `No supplier was specified and the requisition has no suggested supplier: ${identifier}`,
);

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

export const PaymentTermInactiveError = createDomainError(
  "PaymentTermInactiveError", "PURCHASE_PAYMENT_TERM_INACTIVE",
  (identifier: string) => `Referenced purchase payment term is inactive: ${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 PurchaseOrderLineNotFoundError = createDomainError(
  "PurchaseOrderLineNotFoundError", "PURCHASE_PURCHASE_ORDER_LINE_NOT_FOUND",
  (identifier: string) => `Referenced purchase-order line does not exist: ${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) => `Purchase order has no lines: ${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 InvalidListPriorityError = createDomainError(
  "InvalidListPriorityError", "PURCHASE_INVALID_LIST_PRIORITY",
  (identifier: string) => `List priority conflicts with deterministic supplier or rule ordering: ${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 EmptyPurchaseRequisitionLinesError = createDomainError(
  "EmptyPurchaseRequisitionLinesError", "PURCHASE_EMPTY_PURCHASE_REQUISITION_LINES",
  (identifier: string) => `Purchase requisition has no lines: ${identifier}`,
);

export const DescriptionRequiredError = createDomainError(
  "DescriptionRequiredError", "PURCHASE_DESCRIPTION_REQUIRED",
  (identifier: string) => `A line is missing a description: ${identifier}`,
);

export const InvalidEstimatedUnitPriceError = createDomainError(
  "InvalidEstimatedUnitPriceError", "PURCHASE_INVALID_ESTIMATED_UNIT_PRICE",
  (identifier: string) => `Estimated unit price is negative: ${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 PaymentScheduleCalculationFailedError = createDomainError(
  "PaymentScheduleCalculationFailedError", "PURCHASE_PAYMENT_SCHEDULE_CALCULATION_FAILED",
  (identifier: string) => `Due schedule could not be derived from the payment-term snapshot: ${identifier}`,
);

export const RecallNotAuthorizedError = createDomainError(
  "RecallNotAuthorizedError", "PURCHASE_RECALL_NOT_AUTHORIZED",
  (identifier: string) => `Caller is not the original requester of the requisition: ${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 CompanyScopeMismatchError = createDomainError(
  "CompanyScopeMismatchError", "PURCHASE_COMPANY_SCOPE_MISMATCH",
  (identifier: string) => `Supplier profile company does not match the payment term company: ${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 PurchaseRequisitionNotDraftError = createDomainError(
  "PurchaseRequisitionNotDraftError", "PURCHASE_PURCHASE_REQUISITION_NOT_DRAFT",
  (identifier: string) => `Purchase requisition is not in DRAFT status: ${identifier}`,
);

export const ImmutableCompanyScopeError = createDomainError(
  "ImmutableCompanyScopeError", "PURCHASE_IMMUTABLE_COMPANY_SCOPE",
  (identifier: string) => `Update attempted to move the term into another company: ${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 NoMatchingPriceRuleError = createDomainError(
  "NoMatchingPriceRuleError", "PURCHASE_NO_MATCHING_PRICE_RULE",
  (identifier: string) => `No active rule matches the inputs; response still succeeds with null priceSuggestion and null matchedRule: ${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}`,
);
