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

export const ProductNotFoundError = createDomainError(
  "ProductNotFoundError", "PRODUCT_MANAGEMENT_PRODUCT_NOT_FOUND",
  (identifier: string) => `Specified product ID does not exist: ${identifier}`,
);

export const InvalidStateTransitionError = createDomainError(
  "InvalidStateTransitionError", "PRODUCT_MANAGEMENT_INVALID_STATE_TRANSITION",
  (identifier: string) => `Product is not in DRAFT status: ${identifier}`,
);

export const CategoryNotFoundError = createDomainError(
  "CategoryNotFoundError", "PRODUCT_MANAGEMENT_CATEGORY_NOT_FOUND",
  (identifier: string) => `Specified category ID does not exist: ${identifier}`,
);

export const DuplicateCodeError = createDomainError(
  "DuplicateCodeError", "PRODUCT_MANAGEMENT_DUPLICATE_CODE",
  (identifier: string) => `A product with the same code already exists: ${identifier}`,
);

export const MissingRequiredFieldError = createDomainError(
  "MissingRequiredFieldError", "PRODUCT_MANAGEMENT_MISSING_REQUIRED_FIELD",
  (identifier: string) => `Code, name, or UoM not provided: ${identifier}`,
);

export const InvalidUomError = createDomainError(
  "InvalidUomError", "PRODUCT_MANAGEMENT_INVALID_UOM",
  (identifier: string) => `Referenced unit does not exist or is inactive: ${identifier}`,
);

export const AttributeNotFoundError = createDomainError(
  "AttributeNotFoundError", "PRODUCT_MANAGEMENT_ATTRIBUTE_NOT_FOUND",
  (identifier: string) => `Specified attribute ID does not exist: ${identifier}`,
);

export const InvalidLabelError = createDomainError(
  "InvalidLabelError", "PRODUCT_MANAGEMENT_INVALID_LABEL",
  (identifier: string) => `Label is empty or blank: ${identifier}`,
);

export const DuplicateValueError = createDomainError(
  "DuplicateValueError", "PRODUCT_MANAGEMENT_DUPLICATE_VALUE",
  (identifier: string) => `A value with the same label already exists for this attribute: ${identifier}`,
);

export const ParentNotFoundError = createDomainError(
  "ParentNotFoundError", "PRODUCT_MANAGEMENT_PARENT_NOT_FOUND",
  (identifier: string) => `Specified parent category ID does not exist: ${identifier}`,
);

export const MaxDepthExceededError = createDomainError(
  "MaxDepthExceededError", "PRODUCT_MANAGEMENT_MAX_DEPTH_EXCEEDED",
  (identifier: string) => `Adding this child would exceed the configurable maximum tree depth: ${identifier}`,
);

export const DeleteNotAllowedError = createDomainError(
  "DeleteNotAllowedError", "PRODUCT_MANAGEMENT_DELETE_NOT_ALLOWED",
  (identifier: string) => `Product is not in DRAFT status and cannot be deleted: ${identifier}`,
);

export const AttributeInUseError = createDomainError(
  "AttributeInUseError", "PRODUCT_MANAGEMENT_ATTRIBUTE_IN_USE",
  (identifier: string) => `Attribute is assigned to one or more products and cannot be deleted: ${identifier}`,
);

export const ValueNotFoundError = createDomainError(
  "ValueNotFoundError", "PRODUCT_MANAGEMENT_VALUE_NOT_FOUND",
  (identifier: string) => `Specified attribute value ID does not exist: ${identifier}`,
);

export const ValueInUseError = createDomainError(
  "ValueInUseError", "PRODUCT_MANAGEMENT_VALUE_IN_USE",
  (identifier: string) => `Value is in use on one or more ACTIVE products: ${identifier}`,
);

export const HasChildrenError = createDomainError(
  "HasChildrenError", "PRODUCT_MANAGEMENT_HAS_CHILDREN",
  (identifier: string) => `Category has child categories and cannot be deleted: ${identifier}`,
);

export const HasAssignmentsError = createDomainError(
  "HasAssignmentsError", "PRODUCT_MANAGEMENT_HAS_ASSIGNMENTS",
  (identifier: string) => `Category has product assignments and cannot be deleted: ${identifier}`,
);

export const InvalidProductStatusError = createDomainError(
  "InvalidProductStatusError", "PRODUCT_MANAGEMENT_INVALID_PRODUCT_STATUS",
  (identifier: string) => `Product is not in ACTIVE status (DRAFT or ARCHIVED): ${identifier}`,
);

export const NoVariantAxesError = createDomainError(
  "NoVariantAxesError", "PRODUCT_MANAGEMENT_NO_VARIANT_AXES",
  (identifier: string) => `Product has no attributes with assigned values: ${identifier}`,
);

export const AttributeValueNotFoundError = createDomainError(
  "AttributeValueNotFoundError", "PRODUCT_MANAGEMENT_ATTRIBUTE_VALUE_NOT_FOUND",
  (identifier: string) => `Referenced attribute value no longer exists (data integrity check): ${identifier}`,
);

export const ItemCreationFailedError = createDomainError(
  "ItemCreationFailedError", "PRODUCT_MANAGEMENT_ITEM_CREATION_FAILED",
  (identifier: string) => `Item creation in item-management failed (e.g., duplicate SKU) — entire generation is rolled back: ${identifier}`,
);

export const CircularReferenceError = createDomainError(
  "CircularReferenceError", "PRODUCT_MANAGEMENT_CIRCULAR_REFERENCE",
  (identifier: string) => `Moving the category would create a circular reference (new parent is a descendant): ${identifier}`,
);

export const AssignmentNotFoundError = createDomainError(
  "AssignmentNotFoundError", "PRODUCT_MANAGEMENT_ASSIGNMENT_NOT_FOUND",
  (identifier: string) => `No assignment exists for the specified product and category combination: ${identifier}`,
);

export const ProductArchivedError = createDomainError(
  "ProductArchivedError", "PRODUCT_MANAGEMENT_PRODUCT_ARCHIVED",
  (identifier: string) => `Archived products do not allow any assignment changes: ${identifier}`,
);

export const AxisStructureLockedError = createDomainError(
  "AxisStructureLockedError", "PRODUCT_MANAGEMENT_AXIS_STRUCTURE_LOCKED",
  (identifier: string) => `A new attribute cannot be assigned to an ACTIVE product — the set of attributes is fixed once activated: ${identifier}`,
);

export const InvalidValueError = createDomainError(
  "InvalidValueError", "PRODUCT_MANAGEMENT_INVALID_VALUE",
  (identifier: string) => `Value does not reference a valid ProductAttributeValue for the attribute: ${identifier}`,
);

export const CodeImmutableError = createDomainError(
  "CodeImmutableError", "PRODUCT_MANAGEMENT_CODE_IMMUTABLE",
  (identifier: string) => `Attempt to change the product code: ${identifier}`,
);

export const NoFieldsToUpdateError = createDomainError(
  "NoFieldsToUpdateError", "PRODUCT_MANAGEMENT_NO_FIELDS_TO_UPDATE",
  (identifier: string) => `No updatable fields were provided in the request: ${identifier}`,
);

export const UomLockedError = createDomainError(
  "UomLockedError", "PRODUCT_MANAGEMENT_UOM_LOCKED",
  (identifier: string) => `UoM cannot be changed after product has been activated: ${identifier}`,
);

export const VariantNotFoundError = createDomainError(
  "VariantNotFoundError", "PRODUCT_MANAGEMENT_VARIANT_NOT_FOUND",
  (identifier: string) => `No variant matches the given criteria — caller receives null: ${identifier}`,
);
