// @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 StockAdjustmentNotFoundError = createDomainError(
  "StockAdjustmentNotFoundError", "INVENTORY_STOCK_ADJUSTMENT_NOT_FOUND",
  (identifier: string) => `Referenced stock adjustment does not exist: ${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 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 DuplicateLotNumberError = createDomainError(
  "DuplicateLotNumberError", "INVENTORY_DUPLICATE_LOT_NUMBER",
  (identifier: string) => `A lot with the same number already exists for this item: ${identifier}`,
);

export const InvalidAdjustmentTypeError = createDomainError(
  "InvalidAdjustmentTypeError", "INVENTORY_INVALID_ADJUSTMENT_TYPE",
  (identifier: string) => `Adjustment type is not one of CORRECTION, SCRAP, BLOCK, UNBLOCK: ${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 InvalidQuantityError = createDomainError(
  "InvalidQuantityError", "INVENTORY_INVALID_QUANTITY",
  (identifier: string) => `Quantity is zero or negative: ${identifier}`,
);

export const InvalidFromStockCategoryError = createDomainError(
  "InvalidFromStockCategoryError", "INVENTORY_INVALID_FROM_STOCK_CATEGORY",
  (identifier: string) => `fromStockCategory was set on a non-SCRAP line: ${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 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 InvalidCostingMethodError = createDomainError(
  "InvalidCostingMethodError", "INVENTORY_INVALID_COSTING_METHOD",
  (identifier: string) => `costingMethod is not a recognized value (must be FIFO, AVCO, or STANDARD_COST): ${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 SiteNotFoundError = createDomainError(
  "SiteNotFoundError", "INVENTORY_SITE_NOT_FOUND",
  (identifier: string) => `Referenced site does not exist: ${identifier}`,
);

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

export const InsufficientStockError = createDomainError(
  "InsufficientStockError", "INVENTORY_INSUFFICIENT_STOCK",
  (identifier: string) => `Available stock (onHand - reserved - blocked) is less than the requested quantity (fromBlocked=false): ${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 InvalidUnitCostError = createDomainError(
  "InvalidUnitCostError", "INVENTORY_INVALID_UNIT_COST",
  (identifier: string) => `Unit cost is zero or negative: ${identifier}`,
);

export const StockLevelNotFoundError = createDomainError(
  "StockLevelNotFoundError", "INVENTORY_STOCK_LEVEL_NOT_FOUND",
  (identifier: string) => `No stock level record exists for the item-location pair: ${identifier}`,
);

export const InsufficientReservedStockError = createDomainError(
  "InsufficientReservedStockError", "INVENTORY_INSUFFICIENT_RESERVED_STOCK",
  (identifier: string) => `Release amount exceeds the currently reserved quantity: ${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 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}`,
);
