mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-09 11:12:52 +00:00
143 lines
4.1 KiB
TypeScript
143 lines
4.1 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 {SCMetaTranslations, SCTranslations} from '../general/i18n';
|
|
import {
|
|
SCPlace,
|
|
SCPlaceWithoutReferences,
|
|
SCPlaceWithoutReferencesMeta,
|
|
SCPlaceWithoutReferencesTranslatableProperties,
|
|
} from './abstract/place';
|
|
import {SCThingMeta, SCThingType} from './abstract/thing';
|
|
import {
|
|
SCThingWithCategories,
|
|
SCThingWithCategoriesSpecificValues,
|
|
SCThingWithCategoriesTranslatableProperties,
|
|
SCThingWithCategoriesWithoutReferences,
|
|
SCThingWithCategoriesWithoutReferencesMeta,
|
|
} from './abstract/thing-with-categories';
|
|
|
|
export type SCBuildingCategories =
|
|
'cafe'
|
|
| 'education'
|
|
| 'library'
|
|
| 'office'
|
|
| 'canteen'
|
|
| 'student canteen'
|
|
| 'restaurant'
|
|
| 'restroom';
|
|
|
|
export interface SCBuildingWithoutReferences
|
|
extends SCThingWithCategoriesWithoutReferences<SCBuildingCategories, SCThingWithCategoriesSpecificValues>,
|
|
SCPlaceWithoutReferences {
|
|
/**
|
|
* List of floor names of the place
|
|
*
|
|
* @filterable
|
|
* @keyword
|
|
*/
|
|
floors?: string[];
|
|
|
|
/**
|
|
* Translated fields of a building
|
|
*/
|
|
translations?: SCTranslations<SCBuildingTranslatableProperties>;
|
|
|
|
/**
|
|
* Type of the building
|
|
*/
|
|
type: SCThingType.Building;
|
|
}
|
|
|
|
/**
|
|
* A building
|
|
*
|
|
* @validatable
|
|
* @indexable
|
|
*/
|
|
export interface SCBuilding
|
|
extends SCBuildingWithoutReferences, SCPlace,
|
|
SCThingWithCategories<SCBuildingCategories, SCThingWithCategoriesSpecificValues> {
|
|
/**
|
|
* Translated fields of a building
|
|
*/
|
|
translations?: SCTranslations<SCBuildingTranslatableProperties>;
|
|
|
|
/**
|
|
* Type of the building
|
|
*/
|
|
type: SCThingType.Building;
|
|
}
|
|
|
|
export interface SCBuildingTranslatableProperties
|
|
extends SCPlaceWithoutReferencesTranslatableProperties, SCThingWithCategoriesTranslatableProperties {
|
|
/**
|
|
* @see SCBuilding.floors
|
|
*/
|
|
floors?: string[];
|
|
}
|
|
|
|
/**
|
|
* Meta information about a place
|
|
*/
|
|
export class SCBuildingMeta
|
|
extends SCThingMeta
|
|
implements SCMetaTranslations<SCBuilding> {
|
|
/**
|
|
* Translations of fields
|
|
*/
|
|
fieldTranslations = {
|
|
de: {
|
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
|
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.de,
|
|
floors: 'Etagen',
|
|
},
|
|
en: {
|
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
|
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
|
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldTranslations.en,
|
|
floors: 'floors',
|
|
},
|
|
};
|
|
|
|
/**
|
|
* Translations of values of fields
|
|
*/
|
|
fieldValueTranslations = {
|
|
de: {
|
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
|
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.de,
|
|
categories: {
|
|
'cafe': 'Café',
|
|
'canteen': 'Kantine',
|
|
'education': 'Bildung',
|
|
'library': 'Bibliothek',
|
|
'office': 'Büro',
|
|
'restaurant': 'Restaurant',
|
|
'restroom': 'Toilette',
|
|
'student canteen': 'Mensa',
|
|
},
|
|
type: 'Gebäude',
|
|
},
|
|
en: {
|
|
...SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCBuildingCategories,
|
|
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
|
|
...SCPlaceWithoutReferencesMeta.getInstance<SCPlaceWithoutReferencesMeta>().fieldValueTranslations.en,
|
|
type: SCThingType.Building,
|
|
},
|
|
};
|
|
}
|