import api from './api';

export const registerUser = (username, password) => api.post('/auth/register', { username, password });
export const loginUser = (username, password) => api.post('/auth/login', { username, password });

export const createProduct = (productData) => api.post('/products/create', productData);
export const getAllProducts = () => api.get('/products/all');
export const updateProduct = (id, productData) => api.put(`/products/${id}`, productData);
export const deleteProduct = (id) => api.delete(`/products/${id}`);


export const createWarehouse = (warehouseData) => api.post('/warehouses/create', warehouseData);
export const getAllWarehouses = () => api.get('/warehouses/all');

export const createTransaction = (transactionData) => api.post('/transactions/create', transactionData);
export const getAllTransactions = () => api.get('/transactions/all');
export const getTransactionById = (id) => api.get(`/transactions/${id}`);
export const updateTransaction = (id, transactionData) => api.put(`/transactions/${id}`, transactionData);
export const deleteTransaction = (id) => api.delete(`/transactions/${id}`);
export const getStockReport = (startDate, endDate, reportType) =>
  api.get('/transactions/report', { params: { startDate, endDate, reportType } });
