import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PtCampusVO, PtCampusForm, PtCampusQuery } from '@/api/basics/customer/ptCampus/types';
import { PtSchoolQuery, PtSchoolVO } from '../ptSchool/types';

/**
 * 查询校区信息列表
 * @param query
 * @returns {*}
 */
export const listPtCampus = (query?: PtCampusQuery): AxiosPromise<PtCampusVO[]> => {
  return request({
    url: '/backstage/customer/ptCampus/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询校区信息详细
 * @param campusId
 */
export const getPtCampus = (campusId: string | number): AxiosPromise<PtCampusVO> => {
  return request({
    url: '/backstage/customer/ptCampus/' + campusId,
    method: 'get'
  });
};

/**
 * 新增校区信息
 * @param data
 */
export const addPtCampus = (data: PtCampusForm) => {
  return request({
    url: '/backstage/customer/ptCampus',
    method: 'post',
    data: data
  });
};

/**
 * 修改校区信息
 * @param data
 */
export const updatePtCampus = (data: PtCampusForm) => {
  return request({
    url: '/backstage/customer/ptCampus',
    method: 'put',
    data: data
  });
};

/**
 * 删除校区信息
 * @param campusId
 */
export const delPtCampus = (campusId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/customer/ptCampus/' + campusId,
    method: 'delete'
  });
};
/**
 * 查询学校信息列表
 * @param query
 * @returns {*}
 */
export const listPtSchool = (query?: PtSchoolQuery): AxiosPromise<PtSchoolVO[]> => {
  return request({
    url: '/backstage/customer/ptSchool/list',
    method: 'get',
    params: query
  });
};