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

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

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

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

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

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

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