namespace MilitaryTrainingManagement.Models.DTOs;

/// <summary>
/// 审计日志响应DTO
/// </summary>
public class AuditLogDto
{
    public int Id { get; set; }
    public string EntityType { get; set; } = string.Empty;
    public int EntityId { get; set; }
    public string Action { get; set; } = string.Empty;
    public string? Description { get; set; }
    public string? OldValues { get; set; }
    public string? NewValues { get; set; }
    public string? ChangedFields { get; set; }
    public int? UserId { get; set; }
    public string? UserName { get; set; }
    public int? OrganizationalUnitId { get; set; }
    public string? OrganizationalUnitName { get; set; }
    public DateTime Timestamp { get; set; }
    public string? IpAddress { get; set; }
    public string? RequestPath { get; set; }
    public bool IsSuccess { get; set; }
    public string? ErrorMessage { get; set; }
}

/// <summary>
/// 审计日志查询请求DTO
/// </summary>
public class AuditLogQueryDto
{
    public string? EntityType { get; set; }
    public int? EntityId { get; set; }
    public string? Action { get; set; }
    public int? UserId { get; set; }
    public int? OrganizationalUnitId { get; set; }
    public DateTime? FromDate { get; set; }
    public DateTime? ToDate { get; set; }
    public bool? IsSuccess { get; set; }
    public int PageNumber { get; set; } = 1;
    public int PageSize { get; set; } = 50;
}

/// <summary>
/// 审计日志统计响应DTO
/// </summary>
public class AuditLogStatisticsDto
{
    public int TotalLogs { get; set; }
    public int CreateOperations { get; set; }
    public int UpdateOperations { get; set; }
    public int DeleteOperations { get; set; }
    public int ApprovalOperations { get; set; }
    public int FailedOperations { get; set; }
    public Dictionary<string, int> OperationsByEntityType { get; set; } = new();
    public Dictionary<string, int> OperationsByAction { get; set; } = new();
}

/// <summary>
/// 实体历史响应DTO
/// </summary>
public class EntityHistoryDto
{
    public string EntityType { get; set; } = string.Empty;
    public int EntityId { get; set; }
    public List<AuditLogDto> History { get; set; } = new();
}
