using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace JobsMedical.Web.Models;
///
/// A permanent / ongoing hiring position (استخدام) — the hiring side of the marketplace,
/// alongside one-off s. No date/time; instead an employment type and a
/// monthly salary range. Reuses for lifecycle (Open/Filled/…).
///
public class JobOpening
{
public int Id { get; set; }
public int FacilityId { get; set; }
public Facility Facility { get; set; } = null!;
public int RoleId { get; set; }
public Role Role { get; set; } = null!;
[Required, MaxLength(200)]
public string Title { get; set; } = ""; // عنوان موقعیت
public EmploymentType EmploymentType { get; set; } = EmploymentType.FullTime;
public long? SalaryMin { get; set; } // حقوق ماهانه (تومان)؛ null = توافقی
public long? SalaryMax { get; set; }
[MaxLength(2000)]
public string? Description { get; set; }
[MaxLength(1000)]
public string? Requirements { get; set; } // شرایط احراز
public Gender GenderRequirement { get; set; } = Gender.Any; // جنسیت مورد نیاز
public ShiftStatus Status { get; set; } = ShiftStatus.Open;
public ShiftSource Source { get; set; } = ShiftSource.Admin;
[MaxLength(500)]
public string? SourceUrl { get; set; }
// APPROXIMATE coords from the source ad (Divar) for aggregated openings without a facility address.
public double? Lat { get; set; }
public double? Lng { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
/// Contact channels harvested from the source ad (aggregated openings). When empty, the
/// detail page falls back to the facility's phone.
public ICollection Contacts { get; set; } = new List();
// Transient: distance (km) when "near me" is active. Not persisted.
[NotMapped] public double? DistanceKm { get; set; }
}