/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { BasePolicy } from './basePolicy.ts';
import type { CategoryDto, PolicyDto } from './policyDto.ts';
import { renderProfileString } from './render.ts';
import { type Category, type NlsString, PolicyType, type LanguageTranslations } from './types.ts';
export class ObjectPolicy extends BasePolicy {
static from(category: CategoryDto, policy: PolicyDto): ObjectPolicy | undefined {
const { type, name, minimumVersion, localization } = policy;
if (type !== 'object' && type !== 'array') {
return undefined;
}
return new ObjectPolicy(name, { moduleName: '', name: { nlsKey: category.name.key, value: category.name.value } }, minimumVersion, { nlsKey: localization.description.key, value: localization.description.value }, '');
}
private constructor(
name: string,
category: Category,
minimumVersion: string,
description: NlsString,
moduleName: string,
) {
super(PolicyType.Object, name, category, minimumVersion, description, moduleName);
}
protected renderADMXElements(): string[] {
return [``];
}
renderADMLPresentationContents() {
return ``;
}
renderJsonValue() {
return '';
}
renderProfileValue(): string {
return ``;
}
renderProfileManifestValue(translations?: LanguageTranslations): string {
return `pfm_default
pfm_description
${renderProfileString(this.name, this.moduleName, this.description, translations)}
pfm_name
${this.name}
pfm_title
${this.name}
pfm_type
string
`;
}
}