import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PtCardTypeVO, PtCardTypeForm, PtCardTypeQuery } from '@/api/basics/basicParameter/ptCardtype/types';

/**
 * 查询卡片类别列表
 * @param query
 * @returns {*}
 */
export const listPtCardType = (query?: PtCardTypeQuery): AxiosPromise<PtCardTypeVO[]> => {
  return request({
    url: '/backstage/basicParameter/ptCardType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询卡片类别详细
 * @param typeId
 */
export const getPtCardType = (typeId: string | number): AxiosPromise<PtCardTypeVO> => {
  return request({
    url: '/backstage/basicParameter/ptCardType/' + typeId,
    method: 'get'
  });
};

/**
 * 新增卡片类别
 * @param data
 */
export const addPtCardType = (data: PtCardTypeForm) => {
  return request({
    url: '/backstage/basicParameter/ptCardType',
    method: 'post',
    data: data
  });
};

/**
 * 修改卡片类别
 * @param data
 */
export const updatePtCardType = (data: PtCardTypeForm) => {
  return request({
    url: '/backstage/basicParameter/ptCardType',
    method: 'put',
    data: data
  });
};

/**
 * 删除卡片类别
 * @param typeId
 */
export const delPtCardType = (typeId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/basicParameter/ptCardType/' + typeId,
    method: 'delete'
  });
};
/**
 * 查询卡片类别列表
 * @returns {*}
 */
export const listUsePtCardType = (): AxiosPromise<PtCardTypeVO[]> => {
  return request({
    url: '/backstage/basicParameter/ptCardType/selectCardType',
    method: 'get'
  });
};
