namespace QYZH.InteractiveMagazine.Models.Dto;

/// <summary>
/// 操作类型常量
/// </summary>
public static class OperationLogActionType
{
    /// <summary>
    /// 手动增加积分
    /// </summary>
    public const string ManualAddPoints = "ManualAddPoints";

    /// <summary>
    /// 手动扣除积分
    /// </summary>
    public const string ManualDeductPoints = "ManualDeductPoints";

    /// <summary>
    /// 补偿任务手动重试
    /// </summary>
    public const string CompensationRetry = "CompensationRetry";

    /// <summary>
    /// 补偿任务标记已解决
    /// </summary>
    public const string CompensationResolve = "CompensationResolve";
}

/// <summary>
/// 目标类型常量
/// </summary>
public static class OperationLogTargetType
{
    /// <summary>
    /// 用户
    /// </summary>
    public const string User = "User";

    /// <summary>
    /// 补偿任务
    /// </summary>
    public const string CompensationTask = "CompensationTask";
}

/// <summary>
/// 操作日志分页查询输入
/// </summary>
public class OperationLogQueryInput : PageQueryModel
{
    /// <summary>
    /// 按操作人用户名筛选（模糊查询）
    /// </summary>
    public string? OperatorName { get; set; }

    /// <summary>
    /// 按操作类型筛选
    /// </summary>
    public string? ActionType { get; set; }

    /// <summary>
    /// 按目标类型筛选
    /// </summary>
    public string? TargetType { get; set; }

    /// <summary>
    /// 按目标记录Id筛选
    /// </summary>
    public long? TargetId { get; set; }
}

/// <summary>
/// 操作日志输出
/// </summary>
public class OperationLogOutput
{
    /// <summary>
    /// 记录Id
    /// </summary>
    public long Id { get; set; }

    /// <summary>
    /// 操作人Id
    /// </summary>
    public long OperatorId { get; set; }

    /// <summary>
    /// 操作人用户名
    /// </summary>
    public string OperatorName { get; set; } = string.Empty;

    /// <summary>
    /// 操作类型
    /// </summary>
    public string ActionType { get; set; } = string.Empty;

    /// <summary>
    /// 目标类型
    /// </summary>
    public string TargetType { get; set; } = string.Empty;

    /// <summary>
    /// 目标记录Id
    /// </summary>
    public long TargetId { get; set; }

    /// <summary>
    /// 目标名称
    /// </summary>
    public string? TargetName { get; set; }

    /// <summary>
    /// 操作详情
    /// </summary>
    public string? Detail { get; set; }

    /// <summary>
    /// IP地址
    /// </summary>
    public string? IpAddress { get; set; }

    /// <summary>
    /// 操作时间
    /// </summary>
    public DateTime CreatedAt { get; set; }
}

/// <summary>
/// 操作日志详情输出
/// </summary>
public class OperationLogDetailOutput
{
    /// <summary>
    /// 记录Id
    /// </summary>
    public long Id { get; set; }

    /// <summary>
    /// 操作类型
    /// </summary>
    public string ActionType { get; set; } = string.Empty;

    /// <summary>
    /// 目标类型
    /// </summary>
    public string TargetType { get; set; } = string.Empty;

    /// <summary>
    /// 目标记录Id
    /// </summary>
    public long TargetId { get; set; }

    /// <summary>
    /// 目标名称
    /// </summary>
    public string? TargetName { get; set; }

    /// <summary>
    /// 操作详情
    /// </summary>
    public string? Detail { get; set; }

    /// <summary>
    /// IP地址
    /// </summary>
    public string? IpAddress { get; set; }

    /// <summary>
    /// 操作时间
    /// </summary>
    public DateTime CreatedAt { get; set; }

    /// <summary>
    /// 操作人用户名
    /// </summary>
    public string OperatorName { get; set; } = string.Empty;

    /// <summary>
    /// 操作人手机号（管理员表无此字段时可为空）
    /// </summary>
    public string? OperatorPhone { get; set; }

    /// <summary>
    /// 操作人角色/类型
    /// </summary>
    public string? OperatorRole { get; set; }

    /// <summary>
    /// 被操作人用户名（当 TargetType 为 User 时）
    /// </summary>
    public string? TargetUserName { get; set; }

    /// <summary>
    /// 被操作人手机号（当 TargetType 为 User 时）
    /// </summary>
    public string? TargetUserPhone { get; set; }

    /// <summary>
    /// 被操作人头像（当 TargetType 为 User 时）
    /// </summary>
    public string? TargetUserAvatar { get; set; }
}
