namespace AIStudio.Models.Matching;
///
/// What the index made of one model name, and how it got there.
///
///
/// The profile alone is what the app asks for. The rest is for the people maintaining the rules:
/// which rule answered, what adjusted the answer afterwards, and whether two rules claimed the name
/// with the same right. The verification run reads all of it; a test that wants to know why a model
/// came out the way it did reads it too.
///
/// Everything known about the model.
/// The rule which chose the model, or null when no rule knows the name.
/// The rules which adjusted the answer, in the order they were applied.
/// Rules which claimed the name just as strongly as the selector did.
public sealed record ModelResolution(ModelProfile Profile, ModelRule? Selector, IReadOnlyList Modifiers, IReadOnlyList TiedSelectors)
{
///
/// The answer for a name no rule was even asked about.
///
public static readonly ModelResolution NOTHING = new(ModelProfile.UNKNOWN, null, [], []);
///
/// Whether more than one rule claimed this name with the same specificity.
///
///
/// Always a mistake in the rules. The answer is still the same one every time, so a build never
/// depends on the order the rules were registered in, but which of the two was meant is
/// something only a person can say.
///
public bool IsAmbiguous => this.TiedSelectors.Count > 0;
///
/// Whether any rule at all knew this name.
///
public bool IsKnown => this.Selector is not null;
}