namespace AIStudio.Assistants.BeyondFactsLab;
///
/// Finds the key details a preparation of the BeyondFacts Lab still lacks.
///
///
/// Missing details never block anything: the person may continue, and the chat asks for them.
///
public static class BflMissingDetails
{
///
/// Gets the key details of a step which its form leaves empty.
///
/// The step.
/// The form of the step.
/// The fields which are missing, in the order the form shows them.
public static IReadOnlyList Of(BflStep step, BflStepFormData form) =>
[.. BflFieldCatalog.ForStep(step).Where(field => field.IsKeyDetail && string.IsNullOrWhiteSpace(form.Get(field.Id)))];
///
/// Gets the steps whose forms leave key details empty.
///
/// The forms of a preparation, by their steps; a step without a form counts as empty.
/// The steps with missing details, in their order.
public static IReadOnlyList StepsOf(IReadOnlyDictionary forms) =>
[.. BflStep.All.Where(step => Of(step, forms.GetValueOrDefault(step) ?? new BflStepFormData()).Count > 0)];
}