import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PackageVO, PackageForm, PackageQuery } from '@/api/system/package/types';

/**
 * 查询品牌套餐列表
 * @param query
 * @returns {*}
 */

export const listPackage = (query?: PackageQuery): AxiosPromise<PackageVO[]> => {
  return request({
    url: '/system/package/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询品牌套餐详细
 * @param id
 */
export const getPackage = (id: string | number): AxiosPromise<PackageVO> => {
  return request({
    url: '/system/package/' + id,
    method: 'get'
  });
};

/**
 * 新增品牌套餐
 * @param data
 */
export const addPackage = (data: PackageForm) => {
  return request({
    url: '/system/package',
    method: 'post',
    data: data
  });
};

/**
 * 修改品牌套餐
 * @param data
 */
export const updatePackage = (data: PackageForm) => {
  return request({
    url: '/system/package',
    method: 'put',
    data: data
  });
};

/**
 * 删除品牌套餐
 * @param id
 */
export const delPackage = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/package/' + id,
    method: 'delete'
  });
};
