Files
openstapps/src/things/course-of-studies.ts
2019-06-19 16:18:03 +02:00

196 lines
5.2 KiB
TypeScript

/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCLanguage, SCMetaTranslations, SCTranslations} from '../general/i18n';
import {SCAcademicDegree, SCAcademicDegreeMeta, SCAcademicDegreeWithoutReferences} from './abstract/academic-degree';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCAcademicPriceGroup,
SCThingThatCanBeOffered,
SCThingThatCanBeOfferedMeta,
SCThingThatCanBeOfferedTranslatableProperties,
SCThingThatCanBeOfferedWithoutReferences,
} from './abstract/thing-that-can-be-offered';
import {SCDateSeriesWithoutReferences} from './date-series';
import {SCOrganizationWithoutReferences} from './organization';
/**
* A course of studies without references
*/
export interface SCCourseOfStudiesWithoutReferences
extends SCAcademicDegreeWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
/**
* The main language in which the course of studies
* is beeing offered
*/
mainLanguage: SCLanguage;
/**
* Actual major of the course of studies (eg. physics)
*
* @keyword
*/
major: string;
/**
* The modes the course of studies is offered in
*/
mode: SCCourseOfStudiesMode;
/**
* The time modes the course of studies is offered in
*/
timeMode: SCCourseOfStudiesTimeMode;
/**
* Translated fields of a dish
*/
translations?: SCTranslations<SCCourseOfStudiesTranslatableProperties>;
/**
* Type of the course of studies
*/
type: SCThingType.CourseOfStudies;
}
/**
* A course of studies
*
* @validatable
* @indexable
*/
export interface SCCourseOfStudies
extends SCCourseOfStudiesWithoutReferences, SCThingThatCanBeOffered<SCAcademicPriceGroup>, SCAcademicDegree {
/**
* The department that manages the course of studies
*/
department: SCOrganizationWithoutReferences;
/**
* The secretary that administers requests and
* questions concerning the course of studies
*/
secretary: SCOrganizationWithoutReferences;
/**
* Dates at which the course of studies is planned to start
*/
startDates?: SCDateSeriesWithoutReferences[];
/**
* Translated fields of a course of studies
*/
translations?: SCTranslations<SCCourseOfStudiesTranslatableProperties>;
/**
* Type of the course of studies
*/
type: SCThingType.CourseOfStudies;
}
/**
* Translatable properties of a course of studies
*/
export interface SCCourseOfStudiesTranslatableProperties
extends SCThingThatCanBeOfferedTranslatableProperties {
// noop
}
/**
* Meta information about a course of studies
*/
export class SCCourseOfStudiesMeta
extends SCThingMeta
implements SCMetaTranslations<SCCourseOfStudies> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>()
.fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
department: 'Fachbereich',
mainLanguage: 'Unterrichtssprache',
major: 'Studienfach',
mode: 'Studiengangsart',
secretary: 'Sekretariat',
startDates: 'Startdatum',
timeMode: 'Zeitmodell',
},
en: {
...SCAcademicDegreeMeta.getInstance<SCAcademicDegreeMeta>()
.fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance<SCAcademicPriceGroup>()
.fieldTranslations.de,
department: 'department',
mainLanguage: 'main language',
major: 'major',
mode: 'mode',
secretary: 'secretary',
startDates: 'start dates',
timeMode: 'time mode',
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
de: {
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.de,
modes: {
combination: 'Kombinationsstudiengang',
'double-degree': 'Doppelstudium',
dual: 'duales Studium',
standard: 'Studium',
},
timeMode: {
fulltime: 'Vollzeitstudiengang',
parttime: 'Teilzeitstudiengang',
},
type: 'Studiengang',
},
en: {
...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en,
modes: {
combination: 'combination course of studies',
'double-degree': 'double degree course of studies',
dual: 'dual course of studies',
standard: 'course of studies',
},
timeMode: {
fulltime: 'full-time',
parttime: 'part-time',
},
type: SCThingType.CourseOfStudies,
},
};
}
/**
* Types of (german) course of studies modes
*/
export type SCCourseOfStudiesMode = 'combination'
| 'dual'
| 'double-degree'
| 'standard' ;
/**
* Types of (german) course of studies time modes
*/
export type SCCourseOfStudiesTimeMode = 'fulltime'
| 'parttime' ;