import { api } from '../api';

export const ProductsApi = {
  search: (search: string, limit = 10) => api.get('/products/search', { search, limit }),
  list: (params?: { page?: number; per_page?: number; search?: string; status?: string; category?: string; sort?: string }) => 
    api.get('/products', params),
  get: (id: number) => api.get(`/products/${id}`),
  create: (data: any) => api.post('/products', data),
  update: (id: number, data: any) => api.put(`/products/${id}`, data),
  delete: (id: number, force: boolean = false) => api.del(`/products/${id}?force=${force ? 'true' : 'false'}`),
  categories: () => api.get('/products/categories'),
};
