import { IStringDictionary } from "../../../base/common/collections.js"; import { IPolicyData } from "../../../base/common/defaultAccount.js"; import { Emitter, Event } from "../../../base/common/event.js"; import { Disposable } from "../../../base/common/lifecycle.js"; import { IManagedSettingsPolicyDefinitions, PolicyName } from "../../../base/common/policy.js"; import { IPolicyService } from "./policy.service.js"; export type PolicyValue = string | number | boolean; /** The source family that produced an effective policy value. */ export declare enum PolicyValueSource { Device = "device", NativeMdm = "nativeMdm", ServerManagedSettings = "serverManagedSettings", FileManagedSettings = "fileManagedSettings", MixedManagedSettings = "mixedManagedSettings", Account = "account", AccountGate = "accountGate" } export type PolicyDefinition = { type: "string" | "number" | "boolean"; /** Must be pure and deterministic because source attribution can evaluate it more than once. */ value?: (policyData: IPolicyData) => string | number | boolean | undefined; managedSettings?: IManagedSettingsPolicyDefinitions; restrictedValue?: PolicyValue; }; /** Returns a structured-clone-safe copy of `definition`, dropping the non-cloneable `value` callback. */ export declare function toSerializablePolicyDefinition(definition: PolicyDefinition): PolicyDefinition; /** * Returns the value to apply for `definition` when the account-policy gate is active * but not satisfied. Uses `definition.restrictedValue` when specified, otherwise falls * back to a type-driven safe default. */ export declare function getRestrictedPolicyValue(definition: PolicyDefinition): PolicyValue; export declare abstract class AbstractPolicyService extends Disposable implements IPolicyService { readonly _serviceBrand: undefined; policyDefinitions: IStringDictionary; protected policies: Map; private readonly policyValueSources; protected readonly _onDidChange: Emitter; readonly onDidChange: Event; updatePolicyDefinitions(policyDefinitions: IStringDictionary): Promise>; getPolicyValue(name: PolicyName): PolicyValue | undefined; getPolicyValueSource(name: PolicyName): PolicyValueSource | undefined; private getStoredPolicyValueSource; serialize(): IStringDictionary<{ definition: PolicyDefinition; value: PolicyValue; }>; protected getPolicyValues(): IStringDictionary; protected updatePolicyValue(name: PolicyName, value: PolicyValue | undefined, source?: PolicyValueSource): boolean; protected clearPolicyValues(): void; protected abstract _updatePolicyDefinitions(policyDefinitions: IStringDictionary): Promise; } export declare class NullPolicyService implements IPolicyService { readonly _serviceBrand: undefined; readonly onDidChange: Event; updatePolicyDefinitions(): Promise<{}>; getPolicyValue(): undefined; getPolicyValueSource(): undefined; serialize(): undefined; policyDefinitions: IStringDictionary; }