Verified Commit 2d4a76a5 authored by Rainer Killinger's avatar Rainer Killinger
Browse files

feat: add schema for course of studies

parent 85c8fc49
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ export type SCThingTypes = 'article'
  | 'book'
  | 'building'
  | 'catalog'
  | 'course of studies'
  | 'date series'
  | 'diff'
  | 'dish'
+132 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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 {SCAcademicDegree} from '../base/AcademicDegree';
import {SCAcademicPriceGroup,
        SCThingThatCanBeOffered,
        SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered';
import {SCThingMeta} from '../Thing';
import {SCLanguage, SCTranslations} from '../types/i18n';
import {SCDateSeriesWithoutReferences} from './DateSeries';
import {SCOrganization} from './Organization';

/**
 * Type of a course of studies
 */
export type SCCourseOfStudiesType = 'course of studies';

/**
 * A course of studies without references
 */
export interface SCCourseOfStudiesWithoutReferences extends
                 SCAcademicDegree,
                 SCThingThatCanBeOffered<SCAcademicPriceGroup> {
  /**
   * The main language in which the course of studies
   * is beeing offered
   */
  mainLanguage: SCLanguage;

  /**
   * Actual major of the course of studies (eg. physics)
   */
  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: SCCourseOfStudiesType;
}

/**
 * A course of studies
 */
export interface SCCourseOfStudies extends SCCourseOfStudiesWithoutReferences {
  /**
   * The department that manages the course of studies
   */
  department: SCOrganization;

  /**
   * The secretary that administers requests and 
   * questions concerning the course of studies
   */
  secretary: SCOrganization;

  /**
   * Dates at which the course of studies is planned to start
   */
  startDates?: SCDateSeriesWithoutReferences[];
}

export interface SCCourseOfStudiesTranslatableProperties
       extends SCThingThatCanBeOfferedTranslatableProperties {
}

/**
 * course of studies meta data
 */
export class SCCourseOfStudiesMeta extends SCThingMeta {
  static fieldTranslations = {
    ...SCThingMeta.fieldTranslations,
    de: {
      academicDegree: 'Hochschulabschluss',
      department: 'Fachbereich',
      major: 'Studienfach',
      modes: 'Studiengangsarten',
      secretary: 'Sekretariat',
    },
  };
  static fieldValueTranslations = {
    ...SCThingMeta.fieldValueTranslations,
    de: {
      modes: {
        combination: 'Kombinationsstudiengang',
        dual: 'Dualer Studiengang',
        fulltime: 'Vollzeitstudiengang',
        parttime: 'Teilzeitstudiengang',
      },
      type: 'Studiengang',
    },
  };
}

/**
 * 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' ;