package com.erp.audit.dto;

import lombok.Data;
import lombok.Builder;
import java.util.Map;
import java.util.List;

/**
 * 审计统计DTO
 */
@Data
@Builder
public class AuditStatisticsDTO {

    /** 总记录数 */
    private Long totalCount;

    /** 成功操作数 */
    private Long successCount;

    /** 失败操作数 */
    private Long failCount;

    /** 敏感操作数 */
    private Long sensitiveCount;

    /** 平均响应时长(ms) */
    private Double avgDuration;

    /** 各操作类型统计 */
    private Map<String, Long> operationTypeStats;

    /** 各模块统计 */
    private Map<String, Long> moduleStats;

    /** 各用户操作统计 */
    private Map<String, Long> userStats;

    /** 每日趋势 */
    private List<DailyTrend> dailyTrends;

    /** Top N活跃用户 */
    private List<UserActivity> topUsers;

    /** Top N高风险操作 */
    private List<OperationRisk> topRiskyOperations;

    @Data
    @Builder
    public static class DailyTrend {
        private String date;
        private Long count;
        private Long successCount;
        private Long failCount;
    }

    @Data
    @Builder
    public static class UserActivity {
        private String username;
        private String realName;
        private Long operationCount;
    }

    @Data
    @Builder
    public static class OperationRisk {
        private String module;
        private String operationType;
        private Long failCount;
        private Long sensitiveCount;
    }
}
