import request from '@/config/axios'

export interface FarmingManagementVO {
  id: number
  supplierId: number
  code?: string
  recordTime: string
  irrigationRecords?: string
  baseFertilizerRecords?: string
  additionalFertilizerRecords?: string
  pesticideRecords?: string
  firstPickingTime?: string
  totalQuantity?: number
  remark?: string
  createTime?: string
  updateTime?: string
  supplierName?: string
}

export interface FarmingManagementPageReqVO {
  supplierId?: number
  code?: string
  recordTime?: string[]
  firstPickingTime?: string[]
  createTime?: string[]
  pageNo?: number
  pageSize?: number
}

// 查询农作物种植管理列表
export function getFarmingManagementPage(params: FarmingManagementPageReqVO) {
  return request.get({ url: '/erp/farming-management/page', params })
}

// 获取农作物种植管理详情
export function getFarmingManagement(id: number) {
  return request.get({ url: `/erp/farming-management/get?id=${id}` })
}

// 新增农作物种植管理
export function createFarmingManagement(data: FarmingManagementVO) {
  return request.post({ url: '/erp/farming-management/create', data })
}

// 修改农作物种植管理
export function updateFarmingManagement(data: FarmingManagementVO) {
  return request.put({ url: '/erp/farming-management/update', data })
}

// 删除农作物种植管理
export function deleteFarmingManagement(id: number) {
  return request.delete({ url: `/erp/farming-management/delete?id=${id}` })
} 
