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

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

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

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

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

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

/**
 * 更新App
 * @param accessId
 * @param status
 * @returns
 */
export function updateAccessStatus(accessId: number, status: number) {
  return apiRequest({
    url: `/oc/access/updateStatus/${accessId}/${status}`,
    method: 'PUT',
  })
}

/**
 * 删除App
 * @param accessId
 * @returns
 */
export function deleteAccessById(accessId: number) {
  return apiRequest({
    url: `/oc/access/${accessId}`,
    method: 'DELETE',
  })
}
