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

// 查询动力能源部行输科备件领用更换记录列表
export function listSparePartsUsageRecord(query?: EmsQuery): Promise<EmsListResponse<SparePartsUsageRecordVO>> {
  return request({
    url: '/ems/info/sparePartsUsageRecord/list',
    method: 'get',
    params: query
  });
}

// 查询动力能源部行输科备件领用更换记录详细
export function getSparePartsUsageRecord(id: EmsId): Promise<EmsDetailResponse<SparePartsUsageRecordVO>> {
  return request({
    url: '/ems/info/sparePartsUsageRecord/' + id,
    method: 'get'
  });
}

// 新增动力能源部行输科备件领用更换记录
export function addSparePartsUsageRecord(data: SparePartsUsageRecordVO): Promise<EmsActionResponse<SparePartsUsageRecordVO>> {
  return request({
    url: '/ems/info/sparePartsUsageRecord',
    method: 'post',
    data: data
  });
}

// 修改动力能源部行输科备件领用更换记录
export function updateSparePartsUsageRecord(data: SparePartsUsageRecordVO): Promise<EmsActionResponse<SparePartsUsageRecordVO>> {
  return request({
    url: '/ems/info/sparePartsUsageRecord',
    method: 'put',
    data: data
  });
}

// 删除动力能源部行输科备件领用更换记录
export function delSparePartsUsageRecord(id: EmsIdParam): Promise<EmsActionResponse> {
  return request({
    url: '/ems/info/sparePartsUsageRecord/' + id,
    method: 'delete'
  });
}
