// 操作类型
export type OperationType =
  | 'CREATE'
  | 'UPDATE'
  | 'DELETE'
  | 'QUERY'
  | 'LOGIN'
  | 'LOGOUT'
  | 'EXPORT'
  | 'IMPORT'
  | 'ENABLE'
  | 'DISABLE'
  | 'OTHER';

// 操作模块
export type OperationModule =
  | 'USER'
  | 'PRODUCT'
  | 'ORDER'
  | 'ARTICLE'
  | 'SYSTEM'
  | 'AUTH'
  | 'OTHER';

// 操作结果
export type OperationStatus = 'success' | 'failure';

// 日志条目
export interface LogItem {
  id: string;
  operatorId: string;
  operatorName: string;
  operatorRole?: string;
  operationType: OperationType;
  operationModule: OperationModule;
  operationDesc: string;
  requestMethod: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
  requestUrl: string;
  requestParams?: string;
  responseData?: string;
  ipAddress: string;
  userAgent?: string;
  status: OperationStatus;
  errorMessage?: string;
  executionTime: number;
  createdAt: string;
}

// 查询参数
export interface LogListParams {
  current?: number;
  pageSize?: number;
  operatorName?: string;
  operationType?: OperationType;
  operationModule?: OperationModule;
  status?: OperationStatus;
  startTime?: string;
  endTime?: string;
  ipAddress?: string;
  timeRange?: [string, string];
  sortField?: string;
  sortOrder?: 'ascend' | 'descend';
}

// 响应结构
export interface LogListResponse {
  data: LogItem[];
  total: number;
  success: boolean;
}

export interface LogDetailResponse {
  data: LogItem;
  success: boolean;
}
