import api from './api'; export type TouchType = 'WATER' | 'FEED' | 'PRUNE' | 'TRAIN' | 'INSPECT' | 'IPM' | 'TRANSPLANT' | 'HARVEST' | 'OTHER'; export interface PlantTouchPoint { id: string; type: TouchType; notes?: string; photoUrls?: string[]; heightCm?: number; widthCm?: number; ipmProduct?: string; ipmDosage?: string; issuesObserved?: boolean; issueType?: string; batchId: string; createdBy: string; createdAt: string; user?: { name: string; email: string; }; } export interface IPMSchedule { id: string; batchId: string; product: string; intervalDays: number; lastTreatment?: string; nextTreatment?: string; isActive: boolean; } export interface DueTreatment { id: string; batchId: string; product: string; nextTreatment: string; batch: { name: string; roomId?: string; room?: { name: string; }; }; } export const touchPointsApi = { // Touch Points create: async (data: Partial) => { const response = await api.post('/touch-points', data); return response.data; }, getAll: async () => { const response = await api.get('/touch-points'); return response.data; }, getByBatch: async (batchId: string) => { const response = await api.get(`/batches/${batchId}/touch-points`); return response.data; }, // IPM getSchedule: async (batchId: string) => { const response = await api.get(`/batches/${batchId}/ipm/schedule`); return response.data; }, saveSchedule: async (data: { batchId: string; product: string; intervalDays: number }) => { const response = await api.post('/ipm/schedule', data); return response.data; }, getDueTreatments: async () => { const response = await api.get('/ipm/due'); return response.data; } };