/*
* 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 .
*/
import {SCMetaTranslations, SCTranslations} from '../general/i18n';
import {
SCCreativeWork,
SCCreativeWorkMeta,
SCCreativeWorkTranslatableProperties,
SCCreativeWorkWithoutReferences,
} from './abstract/creative-work';
import {SCThingMeta, SCThingType} from './abstract/thing';
import {
SCThingWithCategories,
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesTranslatableProperties,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from './abstract/thing-with-categories';
/**
* An article without references
*/
export interface SCArticleWithoutReferences
extends SCCreativeWorkWithoutReferences,
SCThingWithCategoriesWithoutReferences {
/**
* Article itself as markdown
*
* @text
*/
articleBody: string;
/**
* Translated fields of an article
*/
translations?: SCTranslations;
/**
* Type of an article
*/
type: SCThingType.Article;
}
/**
* An article
*
* @validatable
* @indexable
*/
export interface SCArticle
extends SCCreativeWork, SCArticleWithoutReferences,
SCThingWithCategories {
/**
* Translated fields of an article
*/
translations?: SCTranslations;
/**
* Type of an article
*/
type: SCThingType.Article;
}
/**
* Categories of articles
*/
export type SCArticleCategories = 'unipedia';
/**
* Translatable properties of creative works
*/
export interface SCArticleTranslatableProperties
extends SCThingWithCategoriesTranslatableProperties, SCCreativeWorkTranslatableProperties {
/**
* Translation of the article itself as markdown
*
* @text
*/
articleBody?: string[];
}
/**
* Meta information about an article
*/
export class SCArticleMeta
extends SCThingMeta implements SCMetaTranslations {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
...SCCreativeWorkMeta.getInstance().fieldTranslations
.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de,
articleBody: 'Artikelinhalt',
},
en: {
...SCCreativeWorkMeta.getInstance().fieldTranslations
.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en,
articleBody: 'article body',
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
de: {
...SCCreativeWorkMeta.getInstance()
.fieldValueTranslations.de,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
categories: {
'unipedia': 'Unipedia',
},
type: 'Artikel',
},
en: {
...SCCreativeWorkMeta.getInstance()
.fieldValueTranslations.en,
...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
type: SCThingType.Article,
},
};
}