using System.ComponentModel.DataAnnotations;
using System.Text.Json;
using Tiku.Application.Profile;
namespace Tiku.Api.Contracts;
///
/// 资料查询参数。
///
public sealed class ProfileQueryDto
{
///
/// 最近记录数量上限。
///
[Range(1, 50)]
public int? RecentLimit { get; set; }
///
/// 返回数量上限。
///
[Range(1, 20)]
public int? Limit { get; set; }
///
/// 状态。
///
[StringLength(32)]
public string? Status { get; set; }
///
/// 类型。
///
[StringLength(50)]
public string? Type { get; set; }
///
/// 分类。
///
[StringLength(50)]
public string? Category { get; set; }
///
/// 是否包含锁定资源。
///
public bool IncludeLocked { get; set; }
///
/// 来源类型。
///
[StringLength(100)]
public string? SourceType { get; set; }
///
/// 开始时间。
///
public DateTimeOffset? From { get; set; }
///
/// 结束时间。
///
public DateTimeOffset? To { get; set; }
}
///
/// 更新资料请求 DTO。
///
public sealed class UpdateProfileDto
{
///
/// 名称。
///
[StringLength(100)]
public string? Name { get; set; }
///
/// 头像预设。
///
[StringLength(32)]
public string? AvatarPreset { get; set; }
///
/// 地区 ID。
///
public Guid? RegionId { get; set; }
///
/// 已选择院校 ID。
///
public Guid? SelectedSchoolId { get; set; }
///
/// 已选择专业 ID。
///
public Guid? SelectedMajorId { get; set; }
///
/// 统计数据。
///
public JsonElement? Stats { get; set; }
///
/// 进度数据。
///
public JsonElement? Progress { get; set; }
///
/// 模块选择数据。
///
public JsonElement? ModuleSelections { get; set; }
///
/// 最近活动数据。
///
public JsonElement? RecentActivities { get; set; }
public UpdateProfileCommand ToCommand()
{
return new UpdateProfileCommand(
Name,
AvatarPreset,
RegionId,
SelectedSchoolId,
SelectedMajorId,
Stats,
Progress,
ModuleSelections,
RecentActivities);
}
}
///
/// 通知状态请求 DTO。
///
public sealed class NotificationStatusDto
{
///
/// 通知 ID 列表。
///
[Required]
[MinLength(1)]
[MaxLength(100)]
public IReadOnlyCollection NotificationIds { get; set; } = [];
///
/// 状态。
///
[StringLength(32)]
public string? Status { get; set; }
public UpdateNotificationStatusCommand ToCommand()
{
return new UpdateNotificationStatusCommand(NotificationIds, Status);
}
}
///
/// 提交反馈请求 DTO。
///
public sealed class SubmitFeedbackDto
{
///
/// 题目 ID。
///
public Guid? QuestionId { get; set; }
///
/// 类型。
///
[StringLength(50)]
public string? Type { get; set; }
///
/// 分类。
///
[StringLength(100)]
public string? Category { get; set; }
///
/// 标题。
///
[StringLength(200)]
public string? Title { get; set; }
///
/// 说明。
///
[Required]
[StringLength(5000)]
public string Description { get; set; } = string.Empty;
///
/// 优先级。
///
[StringLength(32)]
public string? Priority { get; set; }
///
/// 联系方式。
///
[StringLength(200)]
public string? Contact { get; set; }
///
/// 附件列表。
///
public JsonElement Attachments { get; set; } = JsonSerializer.SerializeToElement(Array.Empty