import api from './api';

export interface WeightLog {
    id: string;
    batchId: string;
    weightType: 'WET' | 'BUCKED' | 'FINAL_DRY' | 'TRIM' | 'WASTE';
    weight: number;
    unit: string;
    notes?: string;
    createdAt: string;
    user?: {
        name: string;
    };
}

export const weightLogsApi = {
    create: async (batchId: string, data: any) => {
        const response = await api.post<WeightLog>(`/batches/${batchId}/weights`, data);
        return response.data;
    },

    getByBatchId: async (batchId: string) => {
        const response = await api.get<WeightLog[]>(`/batches/${batchId}/weights`);
        return response.data;
    }
};
