import type {
  Product,
  ProductAttribute,
  ProductAttributeAssignment,
  ProductAttributeValue,
  ProductCategory,
  ProductCategoryAssignment,
  ProductVariant,
  Schema,
} from "../lib/types";

// Product fixtures
export const baseDraftProduct = {
  id: "product-1",
  code: "CLASSIC-TSHIRT",
  name: "Classic T-Shirt",
  description: null,
  unitId: "unit-pcs",
  status: "DRAFT",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Product<Schema>;

export const baseActiveProduct = {
  id: "product-2",
  code: "PREMIUM-HOODIE",
  name: "Premium Hoodie",
  description: "A premium hoodie",
  unitId: "unit-pcs",
  status: "ACTIVE",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Product<Schema>;

export const baseArchivedProduct = {
  id: "product-3",
  code: "VINTAGE-CAP",
  name: "Vintage Cap",
  description: null,
  unitId: "unit-pcs",
  status: "ARCHIVED",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies Product<Schema>;

// ProductAttribute fixtures
export const baseColorAttribute = {
  id: "attr-1",
  code: "COLOR",
  name: "Color",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductAttribute<Schema>;

export const baseSizeAttribute = {
  id: "attr-5",
  code: "SIZE",
  name: "Size",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductAttribute<Schema>;

// ProductAttributeValue fixtures
export const baseColorRed = {
  id: "value-1",
  attributeId: "attr-1",
  label: "Red",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductAttributeValue<Schema>;

export const baseColorBlue = {
  id: "value-2",
  attributeId: "attr-1",
  label: "Blue",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductAttributeValue<Schema>;

export const baseSizeSmall = {
  id: "value-3",
  attributeId: "attr-5",
  label: "Small",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductAttributeValue<Schema>;

export const baseSizeLarge = {
  id: "value-4",
  attributeId: "attr-5",
  label: "Large",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductAttributeValue<Schema>;

// ProductAttributeAssignment fixtures
export const baseAttributeAssignment = {
  id: "assignment-1",
  productId: "product-2",
  attributeId: "attr-1",
  valueId: "value-1",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductAttributeAssignment<Schema>;

// ProductCategory fixtures
export const baseRootCategory = {
  id: "category-1",
  code: "CLOTHING",
  name: "Clothing",
  parentId: null,
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductCategory<Schema>;

export const baseChildCategory = {
  id: "category-2",
  code: "TOPS",
  name: "Tops",
  parentId: "category-1",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductCategory<Schema>;

export const baseLeafCategory = {
  id: "category-3",
  code: "TSHIRTS",
  name: "T-Shirts",
  parentId: "category-2",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductCategory<Schema>;

// ProductCategoryAssignment fixtures
export const baseCategoryAssignment = {
  id: "cat-assign-1",
  productId: "product-2",
  categoryId: "category-2",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductCategoryAssignment<Schema>;

// ProductVariant fixtures
export const baseVariant = {
  id: "variant-1",
  productId: "product-2",
  axisValueKey: "value-1|value-3",
  itemId: "item-1",
  createdAt: new Date("2024-01-01T00:00:00.000Z"),
  updatedAt: null,
} as const satisfies ProductVariant<Schema>;
