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

// 查询动力能源部行输科废旧备件登记列表
export function listSparePartsRegistration(query?: EmsQuery): Promise<EmsListResponse<PowerEnergySparePartsRegistrationVO>> {
  return request({
    url: '/ems/info/sparePartsRegistration/list',
    method: 'get',
    params: query
  });
}

// 查询动力能源部行输科废旧备件登记详细
export function getSparePartsRegistration(objid: EmsId): Promise<EmsDetailResponse<PowerEnergySparePartsRegistrationVO>> {
  return request({
    url: '/ems/info/sparePartsRegistration/' + objid,
    method: 'get'
  });
}

// 新增动力能源部行输科废旧备件登记
export function addSparePartsRegistration(
  data: PowerEnergySparePartsRegistrationVO
): Promise<EmsActionResponse<PowerEnergySparePartsRegistrationVO>> {
  return request({
    url: '/ems/info/sparePartsRegistration',
    method: 'post',
    data: data
  });
}

// 修改动力能源部行输科废旧备件登记
export function updateSparePartsRegistration(
  data: PowerEnergySparePartsRegistrationVO
): Promise<EmsActionResponse<PowerEnergySparePartsRegistrationVO>> {
  return request({
    url: '/ems/info/sparePartsRegistration',
    method: 'put',
    data: data
  });
}

// 删除动力能源部行输科废旧备件登记
export function delSparePartsRegistration(objid: EmsIdParam): Promise<EmsActionResponse> {
  return request({
    url: '/ems/info/sparePartsRegistration/' + objid,
    method: 'delete'
  });
}
