using Core.Entities;
namespace Core.Utility;
///
/// Utility class for formatting individual student names with overlap and absent markers.
///
public static class StudentNameFormatter
{
///
/// Options for formatting student names.
///
public record FormatOptions
{
///
/// Whether the student is absent. If true, adds "(absent)" suffix. Default is false.
///
public bool IsAbsent { get; init; } = false;
///
/// Whether the student has schedule overlaps. If true, adds "*" suffix. Default is false.
///
public bool HasOverlap { get; init; } = false;
}
///
/// Formats a single student name with overlap and absent markers.
///
/// The student to format.
/// Formatting options.
/// Formatted student name.
public static string FormatStudentName(Student student, FormatOptions options)
{
if (student == null)
return string.Empty;
var name = student.FirstName;
// Add overlap marker
if (options.HasOverlap)
{
name += "*";
}
// Add absent marker
if (options.IsAbsent)
{
name += " (absent)";
}
return name;
}
}