import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PtSchoolVO, PtSchoolForm, PtSchoolQuery } from '@/api/basics/customer/ptSchool/types';

/**
 * 查询单位信息列表
 * @param query
 * @returns {*}
 */
export const listPtSchool = (query?: PtSchoolQuery): AxiosPromise<PtSchoolVO[]> => {
  return request({
    url: '/backstage/customer/ptSchool/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询单位信息详细
 * @param schoolId
 */
export const getPtSchool = (schoolId: string | number): AxiosPromise<PtSchoolVO> => {
  return request({
    url: '/backstage/customer/ptSchool/' + schoolId,
    method: 'get'
  });
};

/**
 * 新增单位信息
 * @param data
 */
export const addPtSchool = (data: PtSchoolForm) => {
  return request({
    url: '/backstage/customer/ptSchool',
    method: 'post',
    data: data
  });
};

/**
 * 修改单位信息
 * @param data
 */
export const updatePtSchool = (data: PtSchoolForm) => {
  return request({
    url: '/backstage/customer/ptSchool',
    method: 'put',
    data: data
  });
};

/**
 * 删除单位信息
 * @param schoolId
 */
export const delPtSchool = (schoolId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/customer/ptSchool/' + schoolId,
    method: 'delete'
  });
};
