namespace PowderCoating.Core.Entities;
///
/// Represents a scheduled appointment for customer drop-offs, pick-ups, consultations, or job work.
///
public class Appointment : BaseEntity
{
///
/// Auto-generated appointment number in format APT-YYMM-####
///
public string AppointmentNumber { get; set; } = string.Empty;
///
/// Brief title/description of the appointment
///
public string Title { get; set; } = string.Empty;
///
/// Detailed description and notes about the appointment
///
public string? Description { get; set; }
// Customer Information
///
/// Optional foreign key to Customer (not required for internal appointments like employee days off)
///
public int? CustomerId { get; set; }
///
/// Optional foreign key to Job (required for JOB_WORK appointment type)
///
public int? JobId { get; set; }
// Lookup Foreign Keys
///
/// Foreign key to AppointmentStatusLookup
///
public int AppointmentStatusId { get; set; }
///
/// Foreign key to AppointmentTypeLookup
///
public int AppointmentTypeId { get; set; }
///
/// Optional foreign key to ApplicationUser assigned to handle this appointment
///
public string? AssignedUserId { get; set; }
// Timing
///
/// Scheduled start date and time (UTC)
///
public DateTime ScheduledStartTime { get; set; }
///
/// Scheduled end date and time (UTC)
///
public DateTime ScheduledEndTime { get; set; }
///
/// Whether this is an all-day appointment (hides specific times)
///
public bool IsAllDay { get; set; } = false;
///
/// Actual start time when customer arrived (UTC, nullable until appointment starts)
///
public DateTime? ActualStartTime { get; set; }
///
/// Actual end time when appointment finished (UTC, nullable until appointment completes)
///
public DateTime? ActualEndTime { get; set; }
// Additional Information
///
/// Optional location at the shop (e.g., "Main Office", "Loading Dock", "Inspection Area")
///
public string? Location { get; set; }
///
/// Internal notes for staff (not visible to customer)
///
public string? Notes { get; set; }
// Reminder Settings
///
/// Whether to send reminder notifications
///
public bool IsReminderEnabled { get; set; } = true;
///
/// How many minutes before appointment to send reminder (default 30 minutes)
///
public int ReminderMinutesBefore { get; set; } = 30;
///
/// UTC timestamp when the reminder was dispatched. Null means it hasn't fired yet.
/// The background service uses this as a deduplication guard to prevent double-sending.
///
public DateTime? ReminderSentAt { get; set; }
// Navigation Properties
public virtual Customer? Customer { get; set; }
public virtual Job? Job { get; set; }
public virtual AppointmentStatusLookup AppointmentStatus { get; set; } = null!;
public virtual AppointmentTypeLookup AppointmentType { get; set; } = null!;
public virtual ApplicationUser? AssignedUser { get; set; }
}