import request from '@/utils/request';
import type { EmsActionResponse, EmsDetailResponse, DailyFaultRecordVO, EmsId, EmsIdParam, EmsListResponse, EmsQuery } from '../types';

// 查询日常故障记录列表
export function listDailyFaultRecord(query?: EmsQuery): Promise<EmsListResponse<DailyFaultRecordVO>> {
  return request({
    url: '/ems/info/dailyFaultRecord/list',
    method: 'get',
    params: query
  });
}

// 查询日常故障记录详细
export function getDailyFaultRecord(id: EmsId): Promise<EmsDetailResponse<DailyFaultRecordVO>> {
  return request({
    url: '/ems/info/dailyFaultRecord/' + id,
    method: 'get'
  });
}

// 新增日常故障记录
export function addDailyFaultRecord(data: DailyFaultRecordVO): Promise<EmsActionResponse<DailyFaultRecordVO>> {
  return request({
    url: '/ems/info/dailyFaultRecord',
    method: 'post',
    data: data
  });
}

// 修改日常故障记录
export function updateDailyFaultRecord(data: DailyFaultRecordVO): Promise<EmsActionResponse<DailyFaultRecordVO>> {
  return request({
    url: '/ems/info/dailyFaultRecord',
    method: 'put',
    data: data
  });
}

// 删除日常故障记录
export function delDailyFaultRecord(id: EmsIdParam): Promise<EmsActionResponse> {
  return request({
    url: '/ems/info/dailyFaultRecord/' + id,
    method: 'delete'
  });
}
