namespace JobsMedical.Web.Models;

public enum InterestEventType
{
    View = 0,        // باز کردن صفحه شیفت
    Click = 1,       // کلیک از فهرست
    Save = 2,        // ذخیره/علاقه‌مندی
    Apply = 3,       // اعلام تمایل
    Dismiss = 4,     // رد کردن
    HideFacility = 5 // پنهان کردن یک مرکز
}

/// <summary>
/// One behavioral signal: this visitor did X to this shift. The accumulated log is the fuel
/// for collaborative filtering and ML ranking later; for now the pattern engine reads recent
/// events to infer affinity (e.g. repeated interest in night shifts at a given facility).
/// </summary>
public class InterestEvent
{
    public long Id { get; set; }

    public string VisitorId { get; set; } = "";
    public Visitor Visitor { get; set; } = null!;

    // Exactly one target is set — a shift or a job opening.
    public int? ShiftId { get; set; }
    public Shift? Shift { get; set; }

    public int? JobOpeningId { get; set; }
    public JobOpening? JobOpening { get; set; }

    public InterestEventType EventType { get; set; }

    /// <summary>For Apply events: the application status the employer/applicant sees
    /// (Interested = new/pending → Accepted/Rejected by the employer, Withdrawn by the applicant).</summary>
    public ApplicationStatus Status { get; set; } = ApplicationStatus.Interested;

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