import type { AxiosResponse } from 'axios'
import type { PageInfo, Result } from '@cacp/ui'
import request from '@/utils/request'
import type { AuditLogInfo, AuditLogQuery } from '@/types/auditLog'
const contextPath = '/auditlog'

export async function getPage(query: AuditLogQuery): Promise<Result<PageInfo<AuditLogInfo>>> {
  const res: AxiosResponse<Result<PageInfo<AuditLogInfo>>> = await request.post(`${contextPath}/get-page`, query)
  return res.data
}

export async function get(logId: string): Promise<Result<AuditLogInfo>> {
  const res: AxiosResponse<Result<AuditLogInfo>> = await request.get(`${contextPath}/get`, {
    params: {
      logId
    }
  })
  return res.data
}
