namespace AIStudio.Assistants.BeyondFactsLab;
///
/// The research which the prompt of a step of the BeyondFacts Lab carries: in the step "Strategy" all of it, in every
/// other step none.
///
/// The research on the topics, by the topics.
/// The research on single people of the current list of participants, in the order of the list.
public sealed record BflStepResearch(IReadOnlyDictionary Topics, IReadOnlyList People)
{
///
/// The research of a step which carries none.
///
public static readonly BflStepResearch NONE = new(new Dictionary(), []);
///
/// Gets the research on those people who stand on the current list of participants, in the order of the list.
///
///
/// The research on a person who is no longer on the list stays stored, but no longer counts.
///
/// The research on the topics, with the list of participants.
/// The research on every person stored for the preparation.
public static BflStepResearch Of(IReadOnlyDictionary topics, IReadOnlyList people)
{
var participants = topics.GetValueOrDefault(BflResearchTopic.PARTICIPANTS)?.Participants ?? [];
var listed = participants
.Select(participant => people.FirstOrDefault(person => participant.HasName(person.Name)))
.OfType()
.ToList();
return new(topics, listed);
}
}