import request from '@/config/axios'

export const OperationMeetingApi = {
  // 查询会议分页
  getOperationMeetingPage: async (params: {
    pageNo: number
    pageSize: number
    deptId?: number
    meetingDate?: string[]
  }) => {
    return await request.get({ url: `/pms/iot-operation-meeting/page`, params })
  },

  // 查询汇总会议列表
  getIntegratedMeetingList: async () => {
    return await request.get({ url: `/pms/iot-operation-meeting/integratedMeeting` })
  },

  // 查询汇总会议详情
  getSummarizedProjectDetails: async (params: { meetingSeries: string; year: string | number }) => {
    return await request.get({
      url: `/pms/iot-operation-meeting/summarizedProjectDetails`,
      params
    })
  },

  // 查询会议详情
  getOperationMeeting: async (id: number) => {
    return await request.get({ url: `/pms/iot-operation-meeting/get?id=${id}` })
  },

  // 保存运营会议及明细
  saveBatch: async (data: { operationMeeting: unknown; details: unknown[] }) => {
    return await request.post({ url: `/pms/iot-operation-meeting/saveBatch`, data })
  },

  getProjectNameOptions: async () => {
    return await request.get({ url: `/pms/iot-operation-meeting/cachedProjects` })
  },

  getCurrentCompanyExtProperties: async () => {
    return await request.get({
      url: `/pms/iot-operation-meeting/currentCompanyExtProperties`,
      hideErrorNotification: true
    })
  },

  getPreviousWorkPlan: async (params: {
    projectName: string
    id?: string | number
    meetingId?: string | number
  }) => {
    return await request.get({ url: `/pms/iot-operation-meeting/previousWorkPlan`, params })
  },

  getMandatoryOrNot: async () => {
    return await request.get({ url: `/pms/iot-operation-meeting/mandatoryOrNot` })
  },

  getDeptList: async () => {
    return await request.get({ url: `/system/dept/includeDisabledCompanies` })
  }
}
