import { config, networkUtils } from '../../utils';

const { request } = networkUtils;
const { api } = config;
const { bid } = api;
const { bids } = bid;

export async function query(params: object) {
  return request({
    url: `${bids}/bids`,
    method: 'get',
    data: params,
  });
}

export async function getSingle(id: number) {
  return request({
    url: `${bids}/bids/${id}`,
    method: 'get',
  });
}

export async function create(params: object) {
  return request({
    url: `${bids}/bids/saveOrUpdate`,
    method: 'post',
    data: params,
  });
}

export async function remove(ids: number[]) {
  return request({
    url: `${bids}/bids`,
    method: 'delete',
    data: ids,
  });
}

export async function update(params: object) {
  return request({
    url: `${bids}/bids`,
    method: 'put',
    data: params,
  });
}

export async function getInit(id: number) {
  return request({
    url: `${bids}/bids/init/${id}`,
    method: 'get',
  });
}
