namespace MeterVault.Infrastructure.Dashboard;
/// A node in the flow graph: a meter, or a synthetic "Other/unmetered" remainder.
///
/// A meter's name — for a remainder node () the parent meter's
/// name. The surrounding wording ("Other (…)") is the UI's to supply, because it is the only layer
/// that knows the reader's language; see Flow_OtherNode.
///
public sealed record FlowNode(string Id, string Label, double Value, int Depth, string? ColorHex, bool IsOther, int? MeterId);
/// A directed flow edge with the quantity that flows along it, in the energy type's base unit.
public sealed record FlowLink(string From, string To, double Value);
///
/// The per-energy-type flow graph (SDD-style topology view): meters as nodes sized by consumption,
/// directed edges sized by the flow along each configured link, plus "Other" remainders where an
/// upstream meter's flow isn't fully accounted for by its sub-meters. Rendered as a Sankey diagram.
///
public sealed record FlowGraph(
short EnergyTypeId,
string EnergyType,
string Unit,
double Total,
IReadOnlyList Nodes,
IReadOnlyList Links)
{
public bool HasData => Nodes.Count > 0;
/// True when meters are actually chained (not just a flat, unlinked list).
public bool HasChain => Links.Count > 0;
}