import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { VersionVO, VersionForm, VersionQuery } from '@/api/app/version/types';

/**
 * 查询APP版本列表
 * @param query
 * @returns {*}
 */

export const listVersion = (query?: VersionQuery): AxiosPromise<VersionVO[]> => {
  return request({
    url: '/app/version/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询APP版本详细
 * @param id
 */
export const getVersion = (id: string | number): AxiosPromise<VersionVO> => {
  return request({
    url: '/app/version/' + id,
    method: 'get'
  });
};

/**
 * 新增APP版本
 * @param data
 */
export const addVersion = (data: VersionForm) => {
  return request({
    url: '/app/version',
    method: 'post',
    data: data
  });
};

/**
 * 修改APP版本
 * @param data
 */
export const updateVersion = (data: VersionForm) => {
  return request({
    url: '/app/version',
    method: 'put',
    data: data
  });
};

/**
 * 删除APP版本
 * @param id
 */
export const delVersion = (id: string | number | Array<string | number>) => {
  return request({
    url: '/app/version/' + id,
    method: 'delete'
  });
};
