using System.ComponentModel.DataAnnotations;

namespace JobsMedical.Web.Models;

/// <summary>
/// Identity is the phone number (OTP login, no passwords). A user is a doctor,
/// a facility admin, or a platform admin.
/// </summary>
public class User
{
    public int Id { get; set; }

    [Required, MaxLength(20)]
    public string Phone { get; set; } = "";          // شماره موبایل، شناسه یکتا

    [MaxLength(150)]
    public string? FullName { get; set; }

    public UserRole Role { get; set; } = UserRole.Doctor;

    public bool IsPhoneVerified { get; set; }

    /// <summary>Banned users can't log in or post (set by admin).</summary>
    public bool IsBanned { get; set; }
    [MaxLength(300)] public string? BanReason { get; set; }

    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

    // --- Profile media (editable at /Me/Profile; stored in-DB so it survives deploys) ---
    public byte[]? Avatar { get; set; }
    [MaxLength(100)] public string? AvatarContentType { get; set; }
    public byte[]? Resume { get; set; }
    [MaxLength(200)] public string? ResumeFileName { get; set; }
    [MaxLength(120)] public string? ResumeContentType { get; set; }

    // Navigation
    public DoctorProfile? DoctorProfile { get; set; }
    public ICollection<Application> Applications { get; set; } = new List<Application>();
}
