export const AssignmentStatuses = ['open', 'closed'] as const;

export type AssignmentStatus = (typeof AssignmentStatuses)[number];

export const AssignmentStatusLabels: Record<AssignmentStatus, string> = {
    open: 'Dibuka',
    closed: 'Ditutup',
};

export type MySubmission = {
    id: number;
    notes: string | null;
    status: 'not_submitted' | 'submitted' | null;
    submitted_at: string | null;
    file_url: string | null;
    file_name: string | null;
};

export type Assignment = {
    id: number;
    course_class_id: number;
    course_class: {
        id: number;
        course: { id: number; code: string; name: string } | null;
        academic_term: {
            id: number;
            academic_year: string;
            semester: string;
        } | null;
        /** Total students enrolled (approved) in this class. */
        enrollments_count: number;
    } | null;
    title: string;
    description: string | null;
    deadline: string;
    /** Governs whether students can still submit — independent of the deadline. */
    status: AssignmentStatus;
    attachment_url: string | null;
    attachment_name: string | null;
    submissions_count: number;
    /** How many of the submissions received already have a score. */
    graded_submissions_count: number;
    /** Only present for the logged-in mahasiswa: their own submission, if any. */
    submissions?: MySubmission[];
    created_at: string;
    updated_at: string;
};
