import request from '@/config/axios'

export interface CheckPlanVO {
  planId?: string
  planCode: string
  planName: string
  equipmentId: number | string
  equipmentName: string
  cycleType: string
  cycleValue: number
  startDate: string
  endDate?: string
  timeWindow: string
  checkItems: string
  sopReference?: string
  assignee: string
  assigneePhone: string
  status: string
  creator?: string
  createTime?: string
  updateTime?: string
}

export const CheckPlanApi = {
  // 分页
  getCheckPlanPage: async (params: any) => {
    return await request.get({ url: '/iot/check-plan/page', params })
  },
  // 单条
  getCheckPlan: async (planId: string) => {
    return await request.get({ url: '/iot/check-plan/get', params: { planId } })
  },
  // 新增
  createCheckPlan: async (data: CheckPlanVO) => {
    return await request.post({ url: '/iot/check-plan/create', data })
  },
  // 修改
  updateCheckPlan: async (data: CheckPlanVO) => {
    return await request.put({ url: '/iot/check-plan/update', data })
  },
  // 删除
  deleteCheckPlan: async (planId: string) => {
    return await request.delete({ url: '/iot/check-plan/delete', params: { planId } })
  },
  // 列表
  getCheckPlanList: async (params: any) => {
    return await request.get({ url: '/iot/check-plan/list', params })
  }
} 