using System.ComponentModel.DataAnnotations;

namespace JobsMedical.Web.Models;

/// <summary>A hospital, clinic, or polyclinic that posts open shifts.</summary>
public class Facility
{
    public int Id { get; set; }

    [Required, MaxLength(200)]
    public string Name { get; set; } = "";           // نام مرکز درمانی

    public FacilityType Type { get; set; } = FacilityType.Hospital;

    public int CityId { get; set; }
    public City City { get; set; } = null!;

    public int? DistrictId { get; set; }             // محله/منطقه
    public District? District { get; set; }

    /// <summary>Seeded sample facility (demo mode) — lets admins seed/clear demo data cleanly.</summary>
    public bool IsDemo { get; set; }

    [MaxLength(500)]
    public string? Address { get; set; }             // آدرس

    public double? Lat { get; set; }                 // مختصات برای نقشه نشان/بلد
    public double? Lng { get; set; }

    [MaxLength(20)]
    public string? Phone { get; set; }               // تلفن تماس مرکز

    [MaxLength(50)]
    public string? BaleId { get; set; }              // شناسه بله برای ارتباط

    public bool IsVerified { get; set; }             // نشان «تأیید شده» (true only when Verification == Verified)

    /// <summary>Verification workflow: employer requests review (+docs) → admin approves/rejects.</summary>
    public VerificationStatus Verification { get; set; } = VerificationStatus.Unverified;
    [MaxLength(500)] public string? VerificationNote { get; set; }   // admin reject reason / note
    public DateTime? VerificationRequestedAt { get; set; }

    // Phase 2: facility self-serve. Null in MVP (admin manages).
    public int? OwnerUserId { get; set; }
    public User? OwnerUser { get; set; }

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

    public ICollection<Shift> Shifts { get; set; } = new List<Shift>();

    /// <summary>Documents the employer uploaded to prove the facility is real (license, etc.).</summary>
    public ICollection<FacilityDocument> Documents { get; set; } = new List<FacilityDocument>();
}
