import type { PageResult } from '@/types/api';

/** 审计日志结果状态。 */
export type AuditLogResultStatus = 'SUCCESS' | 'FAILURE';

/** 审计日志（AuditLogVO）。 */
export interface AuditLogVO {
  logId: number;
  tenantId?: string;
  operatorId?: number;
  operatorName?: string;
  operatorRole?: string;
  /** 业务模块，如 EMPLOYEE / ORG / ROLE / CUSTOMER / FOLLOW_UP / TENANT / SYSTEM。 */
  module?: string;
  /** 操作动作，如 CREATE / UPDATE / DELETE / IMPORT。 */
  action?: string;
  operationDesc?: string;
  entityType?: string;
  entityId?: string;
  entityName?: string;
  changeDetail?: string;
  requestIp?: string;
  userAgent?: string;
  requestPath?: string;
  requestMethod?: string;
  resultStatus?: AuditLogResultStatus;
  errorMessage?: string;
  createdAt?: string;
}

/** 审计日志分页查询参数（AuditLogPageQuery）。 */
export interface AuditLogPageQuery {
  /** 页码。 */
  page?: number;
  /** 每页条数。 */
  size?: number;
  /** 业务模块。 */
  module?: string;
  /** 操作动作。 */
  action?: string;
  /** 实体类型。 */
  entityType?: string;
  /** 结果状态。 */
  resultStatus?: AuditLogResultStatus;
  /** 操作人 ID。 */
  operatorId?: number;
  /** 开始时间（yyyy-MM-dd HH:mm）。 */
  start?: string;
  /** 结束时间（yyyy-MM-dd HH:mm）。 */
  end?: string;
}

/** 审计日志列表请求参数。 */
export interface TenantAuditLogListRequest extends AuditLogPageQuery {}

/** 审计日志列表响应数据（ResultPageResultAuditLogVO 的 data）。 */
export type TenantAuditLogListResponse = PageResult<AuditLogVO>;

/** ProTable 搜索表单参数，字段与请求参数中可筛选的字段保持一致。 */
export interface AuditLogListQuery {
  current?: number;
  pageSize?: number;
  module?: string;
  action?: string;
  entityType?: string;
  resultStatus?: AuditLogResultStatus;
  operatorId?: number;
  start?: string;
  end?: string;
}
