using ERPCore.Domain.Enums;

namespace ERPCore.Domain.Entities;

/// <summary>
/// Per employee/day attendance row (FR-HR-ATT). <see cref="WorkShiftId"/> is
/// snapshotted from the employee's shift at ingestion time (docs/12-BACKEND-HRM.md
/// A.3) so a later shift reassignment never retroactively changes historical
/// Late/OT figures. Model: docs/12-BACKEND-HRM.md Part C.4.
/// </summary>
public class AttendanceRecord
{
    public int AttendanceRecordId { get; set; }
    public int? AttendanceUploadBatchId { get; set; }
    public AttendanceUploadBatch? AttendanceUploadBatch { get; set; }
    public int EmployeeId { get; set; }
    public Employee? Employee { get; set; }

    public DateTime AttendanceDate { get; set; }
    public TimeSpan? CheckIn { get; set; }
    public TimeSpan? CheckOut { get; set; }
    public int WorkShiftId { get; set; }
    public WorkShift? WorkShift { get; set; }

    public int WorkingMinutes { get; set; }
    public int LateMinutes { get; set; }
    public int EarlyLeaveMinutes { get; set; }
    public int OvertimeMinutes { get; set; }

    public AttendanceStatus AttendanceStatus { get; set; }
    public RowValidationStatus RowValidationStatus { get; set; } = RowValidationStatus.Valid;
    public int? DuplicateOfAttendanceRecordId { get; set; }

    public string? Notes { get; set; }
    public bool IsManualOverride { get; set; }
    public int? EditedBy { get; set; }
    public DateTime? EditedAt { get; set; }

    public uint RowVersion { get; set; }
}
