import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ApplicationVO, ApplicationForm, ApplicationQuery } from '@/api/permission/application/types';

/**
 * 查询应用信息列表
 * @param query
 * @returns {*}
 */

export const listApplication = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: '/perm/application/list',
        method: 'get',
        params: query
    });
};

/**
 * 查询应用信息详细
 * @param id
 */
export const getApplication = (id: string | number): AxiosPromise<ApplicationVO> => {
    return request({
        url: '/perm/application/getInfo/' + id,
        method: 'get'
    });
};

/**
 * 新增应用信息
 * @param data
 */
export const addApplication = (data: ApplicationForm) => {
    return request({
        url: '/perm/application/create',
        method: 'post',
        data: data
    });
};

/**
 * 修改应用信息
 * @param data
 */
export const updateApplication = (data: ApplicationForm) => {
    return request({
        url: '/perm/application/edit',
        method: 'post',
        data: data
    });
};

/**
 * 删除应用信息
 * @param id
 */
export const delApplication = (id: string | number | Array<string | number>) => {
    return request({
        url: '/perm/application/remove/' + id,
        method: 'get'
    });
};
export const ApplicationOnshelf = (id: string | number | Array<string | number>) => {
    return request({
        url: '/perm/application/onshelf/' + id,
        method: 'get'
    });
};
export const ApplicationLeaveshelf = (id: string | number | Array<string | number>) => {
    return request({
        url: '/perm/application/leaveshelf/' + id,
        method: 'get'
    });
};
/**
 * 查询应用信息列表
 * @param query
 * @returns {*}
 */

export const listApplicationQx = (query?: ApplicationQuery): AxiosPromise<ApplicationVO[]> => {
    return request({
        url: '/perm/application/listQx',
        method: 'get',
        params: query
    });
};
/**
 * 查询应用信息列表
 * @param query
 * @returns {*}
 */

export const listApplicationOther = (query?: ApplicationQuery): AxiosPromise<ApplicationVO[]> => {
    return request({
        url: '/perm/application/listOther',
        method: 'get',
        params: query
    });
};
