using Core.Entities;
namespace Core.Models;
///
/// Result of parsing event occurrence text data.
/// Contains parsed occurrences, errors, and warnings.
///
public class EventOccurrenceParseResult
{
///
/// Dictionary of parsed event occurrences, keyed by EventDefinition.
/// For special events (GeneralSchedule, MeetTheCandidates, ChapterOfficerMeeting, VotingDelegateMeeting, SocialGathering),
/// the EventDefinition key will be the static instance.
///
public IDictionary> Occurrences { get; set; } = new Dictionary>();
///
/// List of parsing errors (critical issues that prevented parsing).
///
public List Errors { get; set; } = new();
///
/// List of parsing warnings (non-critical issues that occurred during parsing).
///
public List Warnings { get; set; } = new();
///
/// List of detailed parsing issues with line numbers and specific problem descriptions.
///
public List Issues { get; set; } = new();
///
/// List of section headers that were encountered but skipped
/// because they don't match the chapter's school level setting.
/// Headers may contain " - MS" or " - HS" to indicate school level.
///
public List SkippedSectionHeaders { get; set; } = new();
///
/// Number of event occurrences that were skipped due to school level filtering.
/// This includes both MS and HS events that don't match the chapter's school level setting.
///
public int SkippedEventCount { get; set; }
///
/// Footnotes captured for each event definition. Footnotes are lines that start with "*" or are parenthetical notes.
/// Multiple footnotes are concatenated into a single string. These provide additional context or information about the event occurrences.
///
public IDictionary Footnotes { get; set; } = new Dictionary();
///
/// Total number of event occurrences successfully parsed.
///
public int TotalParsed => Occurrences.Values.Sum(list => list.Count);
///
/// Indicates whether parsing was successful (no errors).
///
public bool IsSuccess => Errors.Count == 0;
}
///
/// Represents a detailed parsing issue encountered during event occurrence parsing.
///
public class ParsingIssue
{
///
/// The line number where the issue occurred (1-based).
///
public int LineNumber { get; set; }
///
/// The column number where the issue occurred (1-based, 0 if not available).
///
public int ColumnNumber { get; set; }
///
/// The actual line content where the issue occurred.
///
public string LineContent { get; set; } = string.Empty;
///
/// The type of parsing issue.
///
public ParsingIssueType IssueType { get; set; }
///
/// Human-readable description of the issue.
///
public string Message { get; set; } = string.Empty;
///
/// What was expected at the error location (e.g., "month name", "MS or HS", "time value").
///
public string Expected { get; set; } = string.Empty;
///
/// What was actually found at the error location.
///
public string Found { get; set; } = string.Empty;
}
///
/// Types of parsing issues that can occur during event occurrence parsing.
///
public enum ParsingIssueType
{
///
/// Line doesn't match the expected format pattern.
///
UnmatchedLine,
///
/// Line matches format but event definition cannot be determined.
///
MissingEventDefinition,
///
/// Time parsing failed (regex doesn't match or parse errors).
///
TimeParseFailure,
///
/// Date parsing failed (invalid day of month, etc.).
///
DateParseFailure,
///
/// Invalid format or other parsing issue.
///
InvalidFormat
}