@using Entities.DTO
@using TechHelper.Client.Exam

@if (ParsedExam != null)
{

	<MudPaper Height="@Height" Class="@Class" Style="@Style" Width="@Width" Elevation="5">
		<MudText Class="d-flex justify-content-center" Typo="Typo.button"> <b> @ParsedExam.Title </b></MudText>
		<MudText Typo="Typo.body1"> @ParsedExam.Description </MudText>

		<ExamStructView ExamStruct="@ParsedExam.ExamStruct" Elevation="0" ClickedStruct="HandleClickedStruct" Class="ma-0 pa-2 rounded-xl" />
	</MudPaper>

}
else
{
	<MudPaper Class="justify-content-center">

		<MudProgressCircular Indeterminate="true" Color="Color.Primary" />
		<MudText Class="ml-4">加载试卷中...</MudText>
	</MudPaper>
}

@code {

	[Parameter]
	public AssignmentDto ParsedExam { get; set; } = new AssignmentDto();

	[Parameter]
	public EventCallback<AssignmentQuestionDto> ClickedStruct { get; set; }

	[Parameter]
	public string Height { get; set; } = "100%";
	[Parameter]
	public string Width { get; set; } = "100%";
	[Parameter]
	public string Class { get; set; } = "";
	[Parameter]
	public string Style { get; set; } = "";


	private void HandleClickedStruct(AssignmentQuestionDto dto)
	{
		ClickedStruct.InvokeAsync(dto);
	}
}