export const RegistrationStatuses = [
    'submitted',
    'approved',
    'rejected',
] as const;

export type RegistrationStatus = (typeof RegistrationStatuses)[number];

export const RegistrationStatusLabels: Record<RegistrationStatus, string> = {
    submitted: 'Diajukan',
    approved: 'Disetujui',
    rejected: 'Ditolak',
};

export type CourseRegistrationStudent = {
    id: number;
    student_number: string;
    current_semester: number;
    department: { id: number; name: string } | null;
    user: { profile: { full_name: string } | null } | null;
};

export type CourseRegistrationCourseClass = {
    id: number;
    academic_term_id: number;
    course: {
        id: number;
        code: string;
        name: string;
        semester_number: number | null;
        department_id: number;
        credits?: number;
    } | null;
    lecturer?: {
        user: { profile: { full_name: string } | null } | null;
    } | null;
};

export type CourseRegistration = {
    id: number;
    student_id: number;
    academic_term_id: number;
    course_class_id: number;
    course_class: CourseRegistrationCourseClass | null;
    created_at: string;
    updated_at: string;
};

export type CourseRegistrationActor = {
    id: number;
    profile: { full_name: string } | null;
};

export type CourseRegistrationSubmissionLog = {
    id: number;
    status: RegistrationStatus;
    reason: string | null;
    actor: CourseRegistrationActor | null;
    created_at: string;
};

export type CourseRegistrationSubmission = {
    id: number;
    student_id: number;
    student: CourseRegistrationStudent | null;
    academic_term_id: number;
    academic_term: { id: number; name: string; semester: string } | null;
    status: RegistrationStatus;
    signed_at: string;
    signature_url: string | null;
    rejection_reason: string | null;
    reviewed_by: number | null;
    reviewer: CourseRegistrationActor | null;
    reviewed_at: string | null;
    course_registrations: CourseRegistration[];
    logs: CourseRegistrationSubmissionLog[];
};
