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

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

export const StorageLocationNotFoundError = createDomainError(
  "StorageLocationNotFoundError", "INVENTORY_STORAGE_LOCATION_NOT_FOUND",
  (identifier: string) => `Referenced storage location does not exist: ${identifier}`,
);

export const DuplicateSerialNumberError = createDomainError(
  "DuplicateSerialNumberError", "INVENTORY_DUPLICATE_SERIAL_NUMBER",
  (identifier: string) => `A serial number with the same value already exists for this item: ${identifier}`,
);

export const InvalidStatusError = createDomainError(
  "InvalidStatusError", "INVENTORY_INVALID_STATUS",
  (identifier: string) => `Target entity is not in a valid status for this operation: ${identifier}`,
);

export const StockAdjustmentNotFoundError = createDomainError(
  "StockAdjustmentNotFoundError", "INVENTORY_STOCK_ADJUSTMENT_NOT_FOUND",
  (identifier: string) => `Referenced stock adjustment does not exist: ${identifier}`,
);

export const InventorySupplyPlanNotFoundError = createDomainError(
  "InventorySupplyPlanNotFoundError", "INVENTORY_INVENTORY_SUPPLY_PLAN_NOT_FOUND",
  (identifier: string) => `Referenced supply plan does not exist: ${identifier}`,
);

export const SupplyPlanNotOpenError = createDomainError(
  "SupplyPlanNotOpenError", "INVENTORY_SUPPLY_PLAN_NOT_OPEN",
  (identifier: string) => `Supply plan is not OPEN: ${identifier}`,
);

export const StockReservationNotFoundError = createDomainError(
  "StockReservationNotFoundError", "INVENTORY_STOCK_RESERVATION_NOT_FOUND",
  (identifier: string) => `Referenced stock reservation does not exist: ${identifier}`,
);

export const StockReservationNotOpenError = createDomainError(
  "StockReservationNotOpenError", "INVENTORY_STOCK_RESERVATION_NOT_OPEN",
  (identifier: string) => `Stock reservation is not OPEN: ${identifier}`,
);

export const TransferOrderNotFoundError = createDomainError(
  "TransferOrderNotFoundError", "INVENTORY_TRANSFER_ORDER_NOT_FOUND",
  (identifier: string) => `Transfer order does not exist: ${identifier}`,
);

export const InvalidStateTransitionError = createDomainError(
  "InvalidStateTransitionError", "INVENTORY_INVALID_STATE_TRANSITION",
  (identifier: string) => `Transfer order lifecycle transition is not allowed: ${identifier}`,
);

export const TransferOrderInTransitError = createDomainError(
  "TransferOrderInTransitError", "INVENTORY_TRANSFER_ORDER_IN_TRANSIT",
  (identifier: string) => `One or more lines still have in-transit quantity: ${identifier}`,
);

export const InsufficientOnHandError = createDomainError(
  "InsufficientOnHandError", "INVENTORY_INSUFFICIENT_ON_HAND",
  (identifier: string) => `On-hand quantity is insufficient for CORRECTION DECREASE, or available portion (onHand - blocked) is insufficient for SCRAP with fromStockCategory=AVAILABLE: ${identifier}`,
);

export const InsufficientAvailableStockError = createDomainError(
  "InsufficientAvailableStockError", "INVENTORY_INSUFFICIENT_AVAILABLE_STOCK",
  (identifier: string) => `Available stock is less than the requested quantity: ${identifier}`,
);

export const InsufficientBlockedStockError = createDomainError(
  "InsufficientBlockedStockError", "INVENTORY_INSUFFICIENT_BLOCKED_STOCK",
  (identifier: string) => `Blocked stock is less than the requested quantity: ${identifier}`,
);

export const InvalidSerialStateForScrapError = createDomainError(
  "InvalidSerialStateForScrapError", "INVENTORY_INVALID_SERIAL_STATE_FOR_SCRAP",
  (identifier: string) => `Serial number is not in AVAILABLE or RETURNED state and cannot be scrapped: ${identifier}`,
);

export const EmptyIssueLinesError = createDomainError(
  "EmptyIssueLinesError", "INVENTORY_EMPTY_ISSUE_LINES",
  (identifier: string) => `No goods issue lines were provided: ${identifier}`,
);

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

export const PrimaryUnitMismatchError = createDomainError(
  "PrimaryUnitMismatchError", "INVENTORY_PRIMARY_UNIT_MISMATCH",
  (identifier: string) => `primaryUnitId differs from Item.unitId: ${identifier}`,
);

export const InvalidUnitConversionRateError = createDomainError(
  "InvalidUnitConversionRateError", "INVENTORY_INVALID_UNIT_CONVERSION_RATE",
  (identifier: string) => `Unit conversion rate is zero or negative: ${identifier}`,
);

export const LotNotFoundError = createDomainError(
  "LotNotFoundError", "INVENTORY_LOT_NOT_FOUND",
  (identifier: string) => `Referenced lot does not exist: ${identifier}`,
);

export const SerialNotFoundError = createDomainError(
  "SerialNotFoundError", "INVENTORY_SERIAL_NOT_FOUND",
  (identifier: string) => `Referenced serial number does not exist: ${identifier}`,
);

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

export const InvalidUnitCostError = createDomainError(
  "InvalidUnitCostError", "INVENTORY_INVALID_UNIT_COST",
  (identifier: string) => `Unit cost is negative: ${identifier}`,
);

export const SupplyPlanUnitMismatchError = createDomainError(
  "SupplyPlanUnitMismatchError", "INVENTORY_SUPPLY_PLAN_UNIT_MISMATCH",
  (identifier: string) => `unitId differs from Item.unitId; caller did not normalize the quantity before inventory handoff: ${identifier}`,
);

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

export const InvalidSupplyPlanQuantitiesError = createDomainError(
  "InvalidSupplyPlanQuantitiesError", "INVENTORY_INVALID_SUPPLY_PLAN_QUANTITIES",
  (identifier: string) => `Quantity values are invalid for a supply plan: ${identifier}`,
);

export const DuplicateLotNumberError = createDomainError(
  "DuplicateLotNumberError", "INVENTORY_DUPLICATE_LOT_NUMBER",
  (identifier: string) => `A lot with the same number already exists for this item: ${identifier}`,
);

export const EmptyAdjustmentLinesError = createDomainError(
  "EmptyAdjustmentLinesError", "INVENTORY_EMPTY_ADJUSTMENT_LINES",
  (identifier: string) => `No adjustment lines were provided: ${identifier}`,
);

export const ReasonCodeRequiredError = createDomainError(
  "ReasonCodeRequiredError", "INVENTORY_REASON_CODE_REQUIRED",
  (identifier: string) => `Reason code was not provided: ${identifier}`,
);

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

export const StorageLocationNotActiveError = createDomainError(
  "StorageLocationNotActiveError", "INVENTORY_STORAGE_LOCATION_NOT_ACTIVE",
  (identifier: string) => `Referenced storage location is not in ACTIVE status: ${identifier}`,
);

export const InvalidFromStockCategoryError = createDomainError(
  "InvalidFromStockCategoryError", "INVENTORY_INVALID_FROM_STOCK_CATEGORY",
  (identifier: string) => `fromStockCategory was set on a non-SCRAP line: ${identifier}`,
);

export const InvalidReservationQuantitiesError = createDomainError(
  "InvalidReservationQuantitiesError", "INVENTORY_INVALID_RESERVATION_QUANTITIES",
  (identifier: string) => `Quantity values are invalid for a stock reservation: ${identifier}`,
);

export const SiteInactiveError = createDomainError(
  "SiteInactiveError", "INVENTORY_SITE_INACTIVE",
  (identifier: string) => `Referenced site is not in ACTIVE status: ${identifier}`,
);

export const DuplicateLocationNameError = createDomainError(
  "DuplicateLocationNameError", "INVENTORY_DUPLICATE_LOCATION_NAME",
  (identifier: string) => `A location with the same name or code already exists in the site: ${identifier}`,
);

export const EmptyTransferLinesError = createDomainError(
  "EmptyTransferLinesError", "INVENTORY_EMPTY_TRANSFER_LINES",
  (identifier: string) => `No transfer lines were provided: ${identifier}`,
);

export const InvalidTransferLocationsError = createDomainError(
  "InvalidTransferLocationsError", "INVENTORY_INVALID_TRANSFER_LOCATIONS",
  (identifier: string) => `Transfer location or site is invalid: ${identifier}`,
);

export const InvalidArgumentError = createDomainError(
  "InvalidArgumentError", "INVENTORY_INVALID_ARGUMENT",
  (identifier: string) => `Argument is invalid: ${identifier}`,
);

export const StandardCostRateRequiredError = createDomainError(
  "StandardCostRateRequiredError", "INVENTORY_STANDARD_COST_RATE_REQUIRED",
  (identifier: string) => `costingMethod is STANDARD_COST but no standardCostRate was provided: ${identifier}`,
);

export const InsufficientStockError = createDomainError(
  "InsufficientStockError", "INVENTORY_INSUFFICIENT_STOCK",
  (identifier: string) => `Available stock cannot cover the requested quantity: ${identifier}`,
);

export const InsufficientLotStockError = createDomainError(
  "InsufficientLotStockError", "INVENTORY_INSUFFICIENT_LOT_STOCK",
  (identifier: string) => `Lot stock is below the issue quantity: ${identifier}`,
);

export const SerialNotAvailableError = createDomainError(
  "SerialNotAvailableError", "INVENTORY_SERIAL_NOT_AVAILABLE",
  (identifier: string) => `Serial number is not in AVAILABLE state: ${identifier}`,
);

export const StorageLocationNotInactiveError = createDomainError(
  "StorageLocationNotInactiveError", "INVENTORY_STORAGE_LOCATION_NOT_INACTIVE",
  (identifier: string) => `Storage location is not in INACTIVE status: ${identifier}`,
);

export const TransferOrderLineNotFoundError = createDomainError(
  "TransferOrderLineNotFoundError", "INVENTORY_TRANSFER_ORDER_LINE_NOT_FOUND",
  (identifier: string) => `Transfer order line does not exist or does not belong to the order: ${identifier}`,
);

export const IssueLineNotFoundError = createDomainError(
  "IssueLineNotFoundError", "INVENTORY_ISSUE_LINE_NOT_FOUND",
  (identifier: string) => `Referenced goods issue line does not exist on the target execution: ${identifier}`,
);

export const ReceiptLineNotFoundError = createDomainError(
  "ReceiptLineNotFoundError", "INVENTORY_RECEIPT_LINE_NOT_FOUND",
  (identifier: string) => `Referenced goods receipt line does not exist on the target execution: ${identifier}`,
);

export const LotFullyConsumedError = createDomainError(
  "LotFullyConsumedError", "INVENTORY_LOT_FULLY_CONSUMED",
  (identifier: string) => `Lot is in FULLY_CONSUMED status and cannot be updated: ${identifier}`,
);

export const StockAdjustmentLineNotFoundError = createDomainError(
  "StockAdjustmentLineNotFoundError", "INVENTORY_STOCK_ADJUSTMENT_LINE_NOT_FOUND",
  (identifier: string) => `Referenced stock adjustment line does not exist on the target adjustment: ${identifier}`,
);

export const ValuationPolicyNotFoundError = createDomainError(
  "ValuationPolicyNotFoundError", "INVENTORY_VALUATION_POLICY_NOT_FOUND",
  (identifier: string) => `Referenced valuation policy does not exist: ${identifier}`,
);

export const ItemValuationNotFoundError = createDomainError(
  "ItemValuationNotFoundError", "INVENTORY_ITEM_VALUATION_NOT_FOUND",
  (identifier: string) => `No valuation record exists for the specified item: ${identifier}`,
);

export const SerialNumberNotFoundError = createDomainError(
  "SerialNumberNotFoundError", "INVENTORY_SERIAL_NUMBER_NOT_FOUND",
  (identifier: string) => `The specified serial number does not exist: ${identifier}`,
);

export const NoFilterProvidedError = createDomainError(
  "NoFilterProvidedError", "INVENTORY_NO_FILTER_PROVIDED",
  (identifier: string) => `At least one filter must be specified: ${identifier}`,
);
