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

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 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) => `UPDATE 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) => `UPDATE reduces quantity below the line's billed quantity: ${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 billed quantity: ${identifier}`,
);

export const RemoveLineHasDownstreamReferencesError = createDomainError(
  "RemoveLineHasDownstreamReferencesError", "PURCHASE_REMOVE_LINE_HAS_DOWNSTREAM_REFERENCES",
  (identifier: string) => `REMOVE targets a line referenced by draft inventory receipt evidence: ${identifier}`,
);

export const EmptyPurchaseOrderLinesError = createDomainError(
  "EmptyPurchaseOrderLinesError", "PURCHASE_EMPTY_PURCHASE_ORDER_LINES",
  (identifier: string) => `Purchase order has no lines: ${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 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 billed quantity already exists 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 CompanyNotFoundError = createDomainError(
  "CompanyNotFoundError", "PURCHASE_COMPANY_NOT_FOUND",
  (identifier: string) => `Referenced company does not exist: ${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 NegativeBilledQuantityError = createDomainError(
  "NegativeBilledQuantityError", "PURCHASE_NEGATIVE_BILLED_QUANTITY",
  (identifier: string) => `Supplied billed quantity is negative: ${identifier}`,
);

export const PurchaseOrderLineNotFoundError = createDomainError(
  "PurchaseOrderLineNotFoundError", "PURCHASE_PURCHASE_ORDER_LINE_NOT_FOUND",
  (identifier: string) => `Referenced purchase-order line does not exist: ${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 PurchaseOrderNotDraftError = createDomainError(
  "PurchaseOrderNotDraftError", "PURCHASE_PURCHASE_ORDER_NOT_DRAFT",
  (identifier: string) => `Purchase order is not in DRAFT status: ${identifier}`,
);

export const PurchaseRequisitionNotDraftError = createDomainError(
  "PurchaseRequisitionNotDraftError", "PURCHASE_PURCHASE_REQUISITION_NOT_DRAFT",
  (identifier: string) => `Purchase requisition is not in DRAFT status: ${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}`,
);
