@using Core.Entities
@model Tuple<Core.Entities.Team, List<Tuple<Student, IEnumerable<Team>>>, string[]?>

@{
	var team = Model.Item1;
	var overlaps = Model.Item2;
}

<tr>
	<td class="@{ GetTeamClass(team); } col-6" >
		<strong>@team</strong> 
		@if (!string.IsNullOrEmpty(team.Event.EventAttributes()))
		{
			<i>(@team.Event.EventAttributes())</i>
		}
		<small><i>@team.Event.SemifinalistActivity</i></small>
		@* 		@if (team.Event.StatePresubmission)
		{
			<small>(pre-submission)</small>
		}

		@if (team.Event.StatePretesting)
		{
			<small>(pre-testing)</small>
		} *@
	</td>

	<td>
		@{ var first = true; }
		@foreach (var student in team.Students.OrderByDescending(s => (s.Grade + s.TsaYear) * (team.Captain == s ? 2 : 1)))
		{
			if (!first)
			{
				<text>, </text>
			}
			{
				first = false;
			}
			@if (overlaps.Any(t => t.Item1 == student))
			{
				<span style="color: #F66">@student.FirstName</span>
			}
			else if(Model.Item3?.Any(s => student.FirstNameLastName.Contains(s))== true)
			{
				<span style="color: lightgray">@student.FirstName</span>
			}
			else
			{
				@student.FirstName

			}
			
			@if (team.Captain == student)
			{
				<span class="text-warning small">•</span>
				@* <i class="bi bi-chevron-double-up text-warning small"></i> *@
			}
		}
	</td>
	<td>
		@team.Event.Documentation
	</td>
	</tr>

@functions
{
	private void GetTeamClass(Team team)
	{
		// if (team.Event.RegionalEvent)
		// {
		// 	@Html.Raw("regional")
		// 	;
		// }
	}
}
