namespace Enmarcha.Backend.Data.Models;
///
/// Defines the scope of an alert (e.g., "stop#vitrasa:1400", "route#xunta:123").
/// This follows a URI-like pattern for easy parsing and matching.
///
public class AlertSelector
{
public string Raw { get; set; } = string.Empty;
public string Type => Raw.Split('#').FirstOrDefault() ?? string.Empty;
public string Id => Raw.Split('#').ElementAtOrDefault(1) ?? string.Empty;
public static AlertSelector FromStop(string feedId, string stopId) => new() { Raw = $"stop#{feedId}:{stopId}" };
public static AlertSelector FromRoute(string feedId, string routeId) => new() { Raw = $"route#{feedId}:{routeId}" };
/// Full GTFS agency id in the form feedId:agencyId (e.g. vitrasa:1).
public static AlertSelector FromAgency(string agencyGtfsId) => new() { Raw = $"agency#{agencyGtfsId}" };
public override string ToString() => Raw;
}