using Nonemm.Core; namespace Nonemm.Spotting; /// One station on the bandmap. public sealed record Spot( Callsign Call, Frequency Frequency, DateTime AtUtc, SpotSource Source, string Spotter = "", string Comment = "") { /// Where the station is listening when it is working split, read out of the /// comment. Zero when it is not. public Frequency Qsx { get; init; } /// False for a mark on the bandmap that is not a station. Nothing judges /// one, nothing offers it as a call to work, and space does not take it /// into the callsign box. public bool IsStation { get; init; } = true; /// N1MM's Mark button leaves one of these where the radio is, to say the /// frequency is busy and not to come back to it. The label is N1MM's, and /// carries the time the mark was left. public static Spot Mark(Frequency where, DateTime atUtc, string spotter = "") => new( Callsign.Parse($"Busy@{atUtc:HH:mm:ss}"), where, atUtc, SpotSource.Operator, spotter, "Non-Counting Station") { IsStation = false, }; /// The computer on the network that put the spot on the bandmap, or empty /// for a spot that came from the cluster. public string Computer { get; init; } = ""; /// A spot an operator put on a bandmap, here or on another computer, as /// opposed to one from the cluster. public bool IsLocal => Source == SpotSource.Operator && IsStation; /// The pseudospot that marks where the operator is running. It is drawn on /// the bandmap and is never added to it. public bool IsCqFrequency { get; init; } public static Spot CqFrequency(Frequency where, DateTime atUtc) => new(Callsign.Parse("CQ Frequency"), where, atUtc, SpotSource.Operator) { IsStation = false, IsCqFrequency = true, }; public bool IsSplit => Qsx.Hertz > 0; public Band? Band => Bands.ForFrequency(Frequency); }