/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { renderADMLString } from './render';
import { Category, LanguageTranslations, NlsString, Policy, PolicyType } from './types';
export abstract class BasePolicy implements Policy {
constructor(
readonly type: PolicyType,
readonly name: string,
readonly category: Category,
readonly minimumVersion: string,
protected description: NlsString,
protected moduleName: string,
) { }
protected renderADMLString(nlsString: NlsString, translations?: LanguageTranslations): string {
return renderADMLString(this.name, this.moduleName, nlsString, translations);
}
renderADMX(regKey: string) {
return [
``,
` `,
` `,
` `,
...this.renderADMXElements(),
` `,
``
];
}
protected abstract renderADMXElements(): string[];
renderADMLStrings(translations?: LanguageTranslations) {
return [
`${this.name}`,
this.renderADMLString(this.description, translations)
];
}
renderADMLPresentation(): string {
return `${this.renderADMLPresentationContents()}`;
}
protected abstract renderADMLPresentationContents(): string;
renderProfile() {
return [`${this.name}`, this.renderProfileValue()];
}
renderProfileManifest(translations?: LanguageTranslations): string {
return `
${this.renderProfileManifestValue(translations)}
`;
}
abstract renderJsonValue(): string | number | boolean | object | null;
abstract renderProfileValue(): string;
abstract renderProfileManifestValue(translations?: LanguageTranslations): string;
}