using QYZH.InteractiveMagazine.Models.Dto;
using QYZH.InteractiveMagazine.Models.Enum;

namespace QYZH.InteractiveMagazine.Models.Dto;

/// <summary>
/// 管理员创建/更新输入
/// </summary>
public class AdminUserInput
{
    /// <summary>
    /// 用户名
    /// </summary>
    public string UserName { get; set; } = string.Empty;

    /// <summary>
    /// 密码（创建时必填，更新时为空表示不修改密码）
    /// </summary>
    public string? Password { get; set; }

    /// <summary>
    /// 管理员类型: SuperAdmin, Editor
    /// </summary>
    public AdminUserTypeEnum Type { get; set; } = AdminUserTypeEnum.Editor;

    /// <summary>
    /// 状态: Active, Inactive
    /// </summary>
    public int Status { get; set; } = 1;

    /// <summary>
    /// 角色ID集合，更新时为null表示不调整角色
    /// </summary>
    public List<long>? RoleIds { get; set; }
}

/// <summary>
/// 管理员输出
/// </summary>
public class AdminUserOutput
{
    /// <summary>
    /// 主键ID
    /// </summary>
    public long Id { get; set; }

    /// <summary>
    /// 用户名
    /// </summary>
    public string UserName { get; set; } = string.Empty;

    /// <summary>
    /// 管理员类型
    /// </summary>
    public string Type { get; set; } = string.Empty;

    /// <summary>
    /// 状态
    /// </summary>
    public int Status { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    public string? CreatedBy { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreatedAt { get; set; }

    /// <summary>
    /// 更新人
    /// </summary>
    public string? UpdatedBy { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdatedAt { get; set; }

    /// <summary>
    /// 角色ID集合
    /// </summary>
    public List<long> RoleIds { get; set; } = [];

    /// <summary>
    /// 角色集合
    /// </summary>
    public List<AdminRoleSimpleOutput> Roles { get; set; } = [];
}

/// <summary>
/// 管理员分页查询输入
/// </summary>
public class AdminUserQueryInput : PageQueryModel
{
    /// <summary>
    /// 用户名（模糊查询）
    /// </summary>
    public string? UserName { get; set; }

    /// <summary>
    /// 管理员类型
    /// </summary>
    public string? Type { get; set; }

    /// <summary>
    /// 状态
    /// </summary>
    public int? Status { get; set; }
}
