using MiaoJiZhang.Domain.Enums;
namespace MiaoJiZhang.Domain.Entities;
///
/// 用户。当前仅用户名+密码注册登录;
/// Email/Phone/微信等字段为预留(决策 2026-07-18),暂不启用。
///
public class User
{
public long Id { get; set; }
public string Username { get; set; } = null!;
public string PasswordHash { get; set; } = null!;
public string? Nickname { get; set; }
public string? AvatarUrl { get; set; }
// ---- 预留:快捷登录(暂不启用,仅建表占位) ----
public string? Email { get; set; }
public bool EmailVerified { get; set; }
public string? Phone { get; set; }
public bool PhoneVerified { get; set; }
public string? WeChatOpenId { get; set; }
public string? WeChatUnionId { get; set; }
public string? AppleUserId { get; set; }
// ---- 模式与 AI 伙伴设置 ----
public AppMode AppMode { get; set; } = AppMode.Normal;
public AiCompanionSetting? AiCompanion { get; set; }
public bool IsBanned { get; set; }
public int AuthVersion { get; set; }
public int AiChatLimit { get; set; } = 50;
public AiQuotaPeriod AiChatPeriod { get; set; } = AiQuotaPeriod.Day;
public int AiChatUsed { get; set; }
public DateTime AiChatWindowStartedAt { get; set; }
public DateTime? AccountClosureRequestedAt { get; set; }
public DateTime? AccountClosureScheduledAt { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? LastLoginAt { get; set; }
public List Ledgers { get; set; } = [];
public List FeaturePermissions { get; set; } = [];
public List PushDevices { get; set; } = [];
public List PushPreferences { get; set; } = [];
}
/// AI 伙伴设置(形象/昵称/性格/滑杆),1:1 User
public class UserFeaturePermission
{
public long Id { get; set; }
public long UserId { get; set; }
public User User { get; set; } = null!;
public string PermissionKey { get; set; } = null!;
public bool IsEnabled { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
public class AiCompanionSetting
{
public long Id { get; set; }
public long UserId { get; set; }
public User User { get; set; } = null!;
/// 形象 key:cat / dog / robot(后台形象库可扩展)
public string AvatarKey { get; set; } = "cat";
/// 用户给 AI 起的名字;空则用形象默认名
public string? CustomName { get; set; }
/// 性格 key,对应后台性格库
public string PersonaKey { get; set; } = "sassy_cat";
/// 吐槽力度 0-100
public int RoastLevel { get; set; } = 60;
/// 表情包频率 0-100
public int StickerFrequency { get; set; } = 70;
/// 主动提醒频率 0-100(映射:关/每周/每天/实时)
public int ProactiveLevel { get; set; } = 40;
}