namespace Core.Parsers.EventOccurrence;
///
/// Shared regex patterns for time parsing.
///
internal static class TimePatterns
{
///
/// AM/PM pattern (case-insensitive via IgnoreCase flag).
/// Matches: "a.m.", "am", "A.M.", "AM", "p.m.", "pm", "P.M.", "PM"
///
public const string AmPm = @"(?:a|p)\.?m\.?";
///
/// Hour pattern: matches 1-2 digits (1-12 or 1-23).
///
public const string Hour = @"\d{1,2}";
///
/// Minute pattern with named group for parsing: matches exactly 2 digits if present.
/// Used when parsing to TimeOnly objects where minutes must be valid.
///
public const string MinuteWithGroup = @"(?\d{2})?";
///
/// Minute pattern for matching: matches 0-2 digits.
/// Used when extracting time strings (more lenient for location parsing).
///
public const string MinuteFlexible = @"\d{0,2}";
///
/// Time value pattern: matches either NOON or a time with AM/PM.
/// Used for matching time strings in location parsing (more lenient minute format).
///
public static string TimeValue => $@"(?:NOON|{Hour}:?{MinuteFlexible}\s*{AmPm})";
///
/// Time pattern with named groups for parsing hour, minute, and AM/PM.
/// Used when parsing to TimeOnly objects (requires 2-digit minutes if present).
///
public static string TimeWithGroups => $@"(?{Hour}):?{MinuteWithGroup}\s?(?{AmPm})";
}