import { axios } from '@/utils/request'
import { stringify } from 'qs'

/**
 * page func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function getRepairProjectRelationPage (parameter) {
  return axios({
    url: '/repair/project-relations/page?' + stringify(parameter),
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * page func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function selectRepairProjectListByRepairId (parameter) {
  return axios({
    url: '/repair/project-relations/repair/' + parameter.id,
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
/**
 * add func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function addRepairProjectRelation (parameter) {
  return axios({
    url: '/repair/project-relations',
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: parameter
  })
}

/**
 * add batch func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function addRepairProjectRelationBatch (parameter) {
  return axios({
    url: '/repair/project-relations/batch',
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: parameter
  })
}

/**
 * add batch func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function importRepairProjectRelation (parameter) {
  return axios({
    url: '/repair/project-relations/import',
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: parameter
  })
}

/**
 * update func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function updateRepairProjectRelation (parameter) {
  return axios({
    url: '/repair/project-relations/' + parameter.id,
    method: 'PUT',
    data: parameter
  })
}

/**
 * fetch single func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function fetchRepairProjectRelation (parameter) {
  return axios({
    url: '/repair/project-relations/' + parameter.id,
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * query list func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function queryRepairProjectRelation (parameter) {
  return axios({
    url: '/repair/project-relations?' + stringify(parameter),
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * delete batch func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function deleteRepairProjectRelations (parameter) {
  return axios({
    url: '/repair/project-relations',
    method: 'DELETE',
    data: parameter
  })
}

/**
 * delete single func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function deleteRepairProjectRelation (parameter) {
  return axios({
    url: '/repair/project-relations/' + parameter.id,
    method: 'DELETE',
    data: parameter
  })
}

/**
 * export file
 * parameter: { }
 * @param parameter :
 * @returns {*}
 */
export function exportRepairProjectRelation (parameter) {
  return axios({
    url: '/repair/project-relations/export?' + stringify(parameter),
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    responseType: 'blob'
  })
}
