Untitled
unknown
plain_text
2 years ago
5.9 kB
3
Indexable
import { LocalizedString, Branding, Homepage, Innovation, Service, Solution, SolutionWithButton, Career, Benefits, Cards, Footer } from "./branding/branding"; import { Lang } from "./branding/BrandingGenerator"; export class BrandingData { protected lang: Lang; protected jsonData: any; protected subBrandings: BrandingData[] = []; constructor(jsonData: any, lang: Lang) { this.jsonData = jsonData this.lang = lang } setLang(lang: Lang) { this.lang = lang this.subBrandings.forEach(subBranding => subBranding.setLang(lang)) } } export class BrandingImpl extends BrandingData implements Branding { _homepage!: Homepage; _service!: Service; _career!: Career; _footer!: Footer; get homepage() { if (!this._homepage) { this._homepage = new HomepageImpl(this.jsonData["homepage"], this.lang) this.subBrandings.push(this._homepage as any as BrandingData) } return this._homepage } get service() { if (!this._service) { this._service = new ServiceImpl(this.jsonData["service"], this.lang) this.subBrandings.push(this._service as any as BrandingData) } return this._service } get career() { if (!this._career) { this._career = new CareerImpl(this.jsonData["career"], this.lang) this.subBrandings.push(this._career as any as BrandingData) } return this._career } get footer() { if (!this._footer) { this._footer = new FooterImpl(this.jsonData["footer"], this.lang) this.subBrandings.push(this._footer as any as BrandingData) } return this._footer } } class HomepageImpl extends BrandingData implements Homepage { _innovation!: Innovation; get innovation() { if (!this._innovation) { this._innovation = new InnovationImpl(this.jsonData["innovation"], this.lang) this.subBrandings.push(this._innovation as any as BrandingData) } return this._innovation } } class InnovationImpl extends BrandingData implements Innovation { _innovationTitle!: LocalizedString; _innovationBoldText!: LocalizedString; _innovationText!: LocalizedString; get innovationTitle() { return this.jsonData["innovationTitle"][this.lang] } get innovationBoldText() { return this.jsonData["innovationBoldText"][this.lang] } get innovationText() { return this.jsonData["innovationText"][this.lang] } } class ServiceImpl extends BrandingData implements Service { _buildSolution!: Solution; _haveSolution!: SolutionWithButton; get buildSolution() { if (!this._buildSolution) { this._buildSolution = new SolutionImpl(this.jsonData["buildSolution"], this.lang) this.subBrandings.push(this._buildSolution as any as BrandingData) } return this._buildSolution } get haveSolution() { if (!this._haveSolution) { this._haveSolution = new SolutionWithButtonImpl(this.jsonData["haveSolution"], this.lang) this.subBrandings.push(this._haveSolution as any as BrandingData) } return this._haveSolution } } class SolutionImpl extends BrandingData implements Solution { _solutionTitle1!: LocalizedString; _solutionTitle2!: LocalizedString; _solutionBoldText!: LocalizedString; _solutionText!: LocalizedString; get solutionTitle1() { return this.jsonData["solutionTitle1"][this.lang] } get solutionTitle2() { return this.jsonData["solutionTitle2"][this.lang] } get solutionBoldText() { return this.jsonData["solutionBoldText"][this.lang] } get solutionText() { return this.jsonData["solutionText"][this.lang] } } class SolutionWithButtonImpl extends BrandingData implements SolutionWithButton { _solution!: Solution; _btnMessage!: LocalizedString; get solution() { if (!this._solution) { this._solution = new SolutionImpl(this.jsonData["solution"], this.lang) this.subBrandings.push(this._solution as any as BrandingData) } return this._solution } get btnMessage() { return this.jsonData["btnMessage"][this.lang] } } class CareerImpl extends BrandingData implements Career { _benefits!: Benefits; get benefits() { if (!this._benefits) { this._benefits = new BenefitsImpl(this.jsonData["benefits"], this.lang) this.subBrandings.push(this._benefits as any as BrandingData) } return this._benefits } } class BenefitsImpl extends BrandingData implements Benefits { _benefitsTitle1!: LocalizedString; _benefitsTitle2!: LocalizedString; _benefitsCards!: object[]; get benefitsTitle1() { return this.jsonData["benefitsTitle1"][this.lang] } get benefitsTitle2() { return this.jsonData["benefitsTitle2"][this.lang] } get benefitsCards() { return this.jsonData["benefitsCards"] } } class CardsImpl extends BrandingData implements Cards { _label!: LocalizedString; _id!: number; _image!: string; get label() { return this.jsonData["label"][this.lang] } get id() { return this.jsonData["id"] } get image() { return this.jsonData["image"] } } class FooterImpl extends BrandingData implements Footer { _copyrightText!: LocalizedString; _imprint!: LocalizedString; _dataProtection!: LocalizedString; get copyrightText() { return this.jsonData["copyrightText"][this.lang] } get imprint() { return this.jsonData["imprint"][this.lang] } get dataProtection() { return this.jsonData["dataProtection"][this.lang] } }
Editor is loading...