import apiRequest from '@/network/http/apiRequest'

/**
 * 获取App分页
 * @param data
 * @returns
 */
export function getAppByPage(data: any) {
  return apiRequest({
    url: '/app/page',
    method: 'GET',
    params: data,
  })
}

/**
 * 获取App列表
 * @param data
 * @returns
 */
export function getAppByList(data: any) {
  return apiRequest({
    url: '/app',
    method: 'GET',
    params: data,
  })
}

/**
 * 根据Id获取App
 * @param appId
 * @returns
 */
export function getAppById(appId: number) {
  return apiRequest({
    url: `/app/${appId}`,
    method: 'GET',
  })
}

/**
 * 添加App
 * @param data
 * @returns
 */
export function createApp(data: any) {
  return apiRequest({
    url: '/app/add',
    method: 'POST',
    data,
  })
}

/**
 * 更新App
 * @param data
 * @returns
 */
export function updateApp(data: any) {
  return apiRequest({
    url: '/app/update',
    method: 'PUT',
    data,
  })
}

/**
 * 更新App
 * @param appId
 * @param status
 * @returns
 */
export function updateAppStatus(appId: number, status: number) {
  return apiRequest({
    url: `/app/updateStatus/${appId}/${status}`,
    method: 'PUT',
  })
}

/**
 * 删除App
 * @param appId
 * @returns
 */
export function deleteAppById(appId: number) {
  return apiRequest({
    url: `/app/${appId}`,
    method: 'DELETE',
  })
}
