const TITLE_SEPARATOR = ' — ';

function normalizeTitlePart(value) {
    return String(value ?? '').trim();
}

export function buildAcademicCalendarTitle({
    specialtyCode,
    specialtyProfileName,
    studyFormName,
    academicYearTitle
} = {}) {
    const parts = [
        specialtyCode,
        specialtyProfileName,
        studyFormName,
        academicYearTitle
    ].map(normalizeTitlePart);

    return parts.every(Boolean) ? parts.join(TITLE_SEPARATOR) : '';
}
