using PowderCoating.Core.Enums;

namespace PowderCoating.Core.Entities;

/// <summary>
/// Facility-level clock-in/clock-out record for an employee.
/// Tracks when an employee arrives and leaves the facility — separate from JobTimeEntry which tracks
/// hours against a specific job. Multiple entries per day are fully supported (lunch breaks, etc.).
/// The only enforced constraint: a user may not have more than one open entry (ClockOutTime == null) at a time.
/// </summary>
public class EmployeeClockEntry : BaseEntity
{
    public string UserId { get; set; } = string.Empty;

    public DateTime ClockInTime { get; set; }

    /// <summary>Null means the employee is currently clocked in.</summary>
    public DateTime? ClockOutTime { get; set; }

    /// <summary>Stored at clock-out time: (ClockOutTime - ClockInTime) in hours, rounded to 2 decimal places.</summary>
    public decimal? HoursWorked { get; set; }

    /// <summary>
    /// Whether this segment is regular work time, a break, or a lunch period.
    /// Only <see cref="ClockEntryType.Work"/> entries count toward paid-hours totals.
    /// </summary>
    public ClockEntryType EntryType { get; set; } = ClockEntryType.Work;

    public string? Notes { get; set; }

    public virtual ApplicationUser User { get; set; } = null!;
}
