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

const { api } = config
const { contract, common } = api
const { contractTmpls } = contract

const { contractCommon } = common;
const { templateCommon } = contractCommon;

export async function query(params) {
  return networkUtils.request({
    url: `${contractTmpls}/`,
    method: 'get',
    data: params,
  })
}

export async function getSingle(id) {
  return networkUtils.request({
    url: `${contractTmpls}/${id}`,
    method: 'get',
  })
}

export async function create(params) {
  return networkUtils.request({
    url: `${contractTmpls}/save`,
    method: 'post',
    data: params,
  })
}

export async function remove(id) {
  return networkUtils.request({
    url: `${contractTmpls}/del/${id}`,
    method: 'post',
    data: id,
  })
}
export async function check(id) {
  return networkUtils.request({
    url: `${contractTmpls}/chk/${id}`,
    method: 'get',
    data: id,
  })
}
export async function update(params) {
  return networkUtils.request({
    url: `${contractTmpls}/update`,
    method: 'post',
    data: params,
  })
}

export async function getTemplage(id) {
  return networkUtils.request({
    url: `${templateCommon}/${id}`,
    method: 'get',
  })
}
