export const DegreeLevels = ['D3', 'D4', 'S1', 'S2', 'S3'] as const;

export type DegreeLevel = (typeof DegreeLevels)[number];

export type DepartmentLecturer = {
    id: number;
    lecturer_number: string;
    user: { profile: { full_name: string } | null } | null;
    departments: { id: number }[];
};

export type DepartmentLeadership = {
    id: number;
    lecturer_id: number;
    started_at: string;
    ended_at: string | null;
    lecturer: DepartmentLecturer | null;
};

export type Department = {
    id: number;
    code: string;
    name: string;
    degree_level: DegreeLevel | null;
    current_leader: DepartmentLeadership | null;
    created_at: string;
    updated_at: string;
};

export function formatDepartmentLabel(department: {
    name: string;
    degree_level?: string | null;
}): string {
    return department.degree_level
        ? `${department.name} (${department.degree_level})`
        : department.name;
}
