import type { BasicFetchResult, BasicPageParams } from '#/api/model';

import { requestClient } from '#/api/request';

export namespace LogApi {
  export interface PageParams extends BasicPageParams {
    name?: string;
  }

  export interface BasicRecordItem {
    name: string;
  }

  export interface RecordItem extends BasicRecordItem {
    id: number;
  }

  export type PageResult = BasicFetchResult<RecordItem>;

  export const getAuditPage = (params: PageParams) =>
    requestClient.get<PageResult>('/logAudit/page', { params });
  export const getOperatePage = (params: PageParams) =>
    requestClient.get<PageResult>('/logOperate/page', { params });
  export const getExceptionPage = (params: PageParams) =>
    requestClient.get<PageResult>('/logException/page', { params });
  export const getDifferencePage = (params: PageParams) =>
    requestClient.get<PageResult>('/logDifference/page', { params });
  export const getVisitPage = (params: PageParams) =>
    requestClient.get<PageResult>('/logVisit/page', { params });

  export const clearLog = (type: string) => requestClient.delete(`/${type}`);
}
