import { apiRequest } from "@/shared/api/request";
import { API_OPERATIONS, apiEndpointPath } from "@/shared/api/generated/endpoints";
import type { ApiPage, LogDto, PageQuery } from "@/shared/api/types";

export function listLoginLogs(query?: PageQuery): Promise<ApiPage<LogDto>> {
  return apiRequest<ApiPage<LogDto>>(apiEndpointPath(API_OPERATIONS.listLoginLogs), { query });
}

export function listOperationLogs(query?: PageQuery): Promise<ApiPage<LogDto>> {
  return apiRequest<ApiPage<LogDto>>(apiEndpointPath(API_OPERATIONS.listOperationLogs), { query });
}

export function exportLoginLogs(query?: PageQuery): Promise<Response> {
  return apiRequest(apiEndpointPath(API_OPERATIONS.exportLoginLogs), { query, raw: true });
}

export function exportOperationLogs(query?: PageQuery): Promise<Response> {
  return apiRequest(apiEndpointPath(API_OPERATIONS.exportOperationLogs), { query, raw: true });
}
