using AIStudio.Components;
using Microsoft.AspNetCore.Components;
namespace AIStudio.Assistants.ModelComparison;
///
/// The progress of a batch with several runs: one badge per run, which says whether it still runs, waits for the vote,
/// or is done.
///
public partial class ModelComparisonRunProgress : MSGComponentBase
{
///
/// Gets or sets the batch.
///
[Parameter, EditorRequired]
public ModelComparisonBatch Batch { get; set; } = null!;
///
/// Gets or sets whether a judge takes part in the batch.
///
[Parameter]
public bool JudgeEnabled { get; set; }
///
/// Says what the badge of a run means, for the tooltip over it: the badge alone only shows a color and a small icon,
/// not enough to be sure what it stands for.
///
/// The position of the run, zero-based.
private string DescribeStatus(int index)
{
var text = this.Batch.StatusOf(index) switch
{
ModelComparisonRunStatus.QUEUED => T("Run {0}: queued, waiting for a free slot."),
ModelComparisonRunStatus.RUNNING => T("Run {0}: still working."),
ModelComparisonRunStatus.NO_USABLE_ANSWER => T("Run {0}: no usable answer, nothing to vote on."),
ModelComparisonRunStatus.VOTED => T("Run {0}: voted on."),
ModelComparisonRunStatus.VOTE_SKIPPED => TA("Run {0}: your vote was skipped."),
_ when this.JudgeEnabled && !this.Batch.HasJudgeVerdict(index) => TA("Run {0}: the judge gave no usable verdict, your vote is missing."),
_ when this.JudgeEnabled => TA("Run {0}: the models and the judge are done, your vote is missing."),
_ => TA("Run {0}: the models are done, your vote is missing."),
};
return string.Format(ModelComparisonFormat.Culture, text, index + 1);
}
}