import { GearItem } from '../types';

const MOCK_INVENTORY: GearItem[] = [
  {
    id: '1',
    name: 'Prophet-6',
    category: 'Synth',
    brand: 'Sequential',
    model: 'Desktop',
    serialNumber: 'SQ-P6-99281',
    purchaseDate: '2023-01-15',
    purchasePrice: 2499,
    currency: 'USD',
    status: 'Active',
    condition: 'Mint',
    vendor: 'Sweetwater',
    image: 'https://picsum.photos/id/100/400/400',
    warrantyExpire: '2025-01-15',
  },
  {
    id: '2',
    name: 'Apollo Twin X',
    category: 'Interface',
    brand: 'Universal Audio',
    model: 'Quad',
    serialNumber: 'UA-TWX-2210',
    purchaseDate: '2022-11-20',
    purchasePrice: 999,
    currency: 'USD',
    status: 'Active',
    condition: 'Good',
    image: 'https://picsum.photos/id/200/400/400',
    warrantyExpire: '2023-11-20',
  },
  {
    id: '3',
    name: 'SM7B',
    category: 'Microphone',
    brand: 'Shure',
    model: 'Dynamic',
    serialNumber: 'SH-SM7-004',
    purchaseDate: '2021-05-10',
    purchasePrice: 399,
    currency: 'USD',
    status: 'Maintenance',
    condition: 'Fair',
    image: 'https://picsum.photos/id/300/400/400',
  },
];

export const gearService = {
  list: async (_params?: {
    category?: string;
    status?: string;
    search?: string;
  }) => {
    await new Promise((resolve) => setTimeout(resolve, 500));
    return MOCK_INVENTORY;
  },

  get: async (id: string) => {
    await new Promise((resolve) => setTimeout(resolve, 200));
    return MOCK_INVENTORY.find((i) => i.id === id) || MOCK_INVENTORY[0];
  },

  create: async (data: Partial<GearItem>) => {
    await new Promise((resolve) => setTimeout(resolve, 800));
    return { ...MOCK_INVENTORY[0], ...data, id: `g-${Date.now()}` };
  },

  update: async (_id: string, data: Partial<GearItem>) => {
    return { ...MOCK_INVENTORY[0], ...data };
  },

  delete: async (_id: string) => {},
};
