namespace AIStudio.Tools.PowerPoint;
///
/// Layouts which offer the same slots at the same places and differ only in their look.
///
///
/// Corporate templates often carry every layout in several colors. The model chooses what goes on a
/// slide, never its color: it sees one entry per family, and the color is chosen for the whole
/// presentation. Since all variants share the slots, slot n of one variant is slot n of every other
/// one.
///
/// The short ID the model uses to name the family, e.g., "L3".
/// The name the layouts share, e.g., "Inhalt/Content 1".
/// The variants, in the order of the template; never empty.
internal sealed record LayoutFamily(string Id, string Name, IReadOnlyList Variants)
{
///
/// The slots every variant of the family offers.
///
public IReadOnlyList Slots => this.Variants[0].Layout.Slots;
///
/// The layout of the given variant, or the first one when the family has no such variant.
///
/// The label of the variant, e.g., "B".
public TemplateLayout GetLayout(string? variantLabel) => (this.Variants.FirstOrDefault(variant => variant.Label == variantLabel) ?? this.Variants[0]).Layout;
}