import { Order } from '@/domain/entities';
import { CustomizationDomainService } from '@/domain/services/CustomizationDomainService';
import { PRODUCT_CATALOG } from './products.data';

function orderItem(
  productId: string,
  quantity: number,
  customizationLabel: string
) {
  const product = PRODUCT_CATALOG.find((p) => p.id === productId)!;
  const customization = CustomizationDomainService.getDefaultCustomization(
    product.category
  );
  return {
    id: CustomizationDomainService.getCartItemKey(productId, customization),
    product,
    quantity,
    customization,
    customizationLabel,
  };
}

const demoAddress = {
  street: 'Tingvallavägen 11',
  city: 'Märsta',
  state: 'Stockholm',
  zip: '195 31',
};

export const DEMO_ORDERS: Order[] = [
  {
    id: 'KG-2026-0042',
    items: [
      orderItem('beef-steak', 2, '8 cuts · Karahi'),
      orderItem('lamb-shoulder', 1, '8 cuts · Nihari'),
    ],
    total: 647,
    status: 'delivered',
    createdAt: '2026-06-10T14:30:00.000Z',
    deliveryAddress: demoAddress,
    paymentMethod: 'card',
  },
  {
    id: 'KG-2026-0051',
    items: [
      orderItem('chicken-whole', 2, '8 cuts · Karahi'),
      orderItem('beef-mince', 1, '8 cuts · Qeema'),
      orderItem('fish-prawns', 1, 'Standard cut'),
    ],
    total: 556,
    status: 'out-for-delivery',
    createdAt: '2026-06-16T09:15:00.000Z',
    deliveryAddress: demoAddress,
    paymentMethod: 'swish',
  },
  {
    id: 'KG-2026-0058',
    items: [
      orderItem('lamb-leg', 1, '8 cuts · Steak'),
      orderItem('fish-salmon', 1, 'Standard cut'),
    ],
    total: 418,
    status: 'preparing',
    createdAt: '2026-06-17T08:00:00.000Z',
    deliveryAddress: demoAddress,
    paymentMethod: 'card',
  },
];