import {Module} from "@/interfaces";
import {InstructorGender} from "./exam";
import {Stat} from "./user";

export type UserResults = {[key in Module]: ModuleResult};

interface ModuleResult {
	exams: string[];
	score: number;
	total: number;
}

export interface AssignmentResult {
	user: string;
	type: "academic" | "general";
	stats: Stat[];
}

export interface Assignment {
	id: string;
	name: string;
	assigner: string;
	assignees: string[];
	results: AssignmentResult[];
	exams: {id: string; module: Module; assignee: string}[];
	instructorGender?: InstructorGender;
	startDate: Date;
	endDate: Date;
	archived?: boolean;
	released?: boolean;
	// unless start is active, the assignment is not visible to the assignees
	// start date now works as a limit time to start the exam
	start?: boolean;
}

export type AssignmentWithCorporateId = Assignment & {corporateId: string};
