using Health.Domain.Enums;
using System.ComponentModel.DataAnnotations.Schema;

namespace Health.Domain.Entities;

/// <summary>
/// 复查/随访计划
/// </summary>
public sealed class FollowUp
{
    public Guid Id { get; set; }
    public Guid UserId { get; set; }
    public string Title { get; set; } = string.Empty;
    public string? DoctorName { get; set; }
    public string? Department { get; set; }
    public DateTime ScheduledAt { get; set; }
    public string? Notes { get; set; }
    public FollowUpStatus Status { get; set; }
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

    public User User { get; set; } = null!;
}

/// <summary>
/// 健康档案
/// </summary>
public sealed class HealthArchive
{
    public Guid Id { get; set; }
    public Guid UserId { get; set; }
    public string? Diagnosis { get; set; }          // 主要诊断
    public string? SurgeryType { get; set; }        // 手术类型
    public DateOnly? SurgeryDate { get; set; }      // 手术日期
    public List<string> Allergies { get; set; } = [];           // 过敏信息
    public List<string> DietRestrictions { get; set; } = [];    // 饮食限制
    public List<string> ChronicDiseases { get; set; } = [];     // 慢病史
    public string? FamilyHistory { get; set; }       // 家族病史
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;

    public User User { get; set; } = null!;
}

/// <summary>
/// 刷新令牌
/// </summary>
public sealed class RefreshToken
{
    public Guid Id { get; set; }
    public Guid UserId { get; set; }
    public string Token { get; set; } = string.Empty;
    public DateTime ExpiresAt { get; set; }
    public bool IsRevoked { get; set; }
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}

/// <summary>
/// 短信验证码
/// </summary>
public sealed class VerificationCode
{
    public Guid Id { get; set; }
    public string Phone { get; set; } = string.Empty;
    public string Code { get; set; } = string.Empty;
    public DateTime ExpiresAt { get; set; }
    public bool IsUsed { get; set; }
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}

/// <summary>
/// 通知偏好
/// </summary>
public sealed class NotificationPreference
{
    public Guid Id { get; set; }
    public Guid UserId { get; set; }
    public bool MedicationReminder { get; set; } = true;
    public bool FollowUpReminder { get; set; } = true;
    public bool DoctorReply { get; set; } = true;
    public bool AbnormalAlert { get; set; } = true;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;

    public User User { get; set; } = null!;
}

/// <summary>
/// 设备推送 token
/// </summary>
public sealed class DeviceToken
{
    public Guid Id { get; set; }
    public Guid UserId { get; set; }
    public string Platform { get; set; } = string.Empty; // ios / android
    public string PushToken { get; set; } = string.Empty;
    public bool IsActive { get; set; } = true;
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;

    public User User { get; set; } = null!;
}
