blob: 2391f45c3c5d6a92c6fb8f3c0e10c7642dceb893 [file] [log] [blame]
Adrià Vilanova Martínez9344d612024-05-11 14:16:38 +02001export enum KillSwitchType {
2 Option = 'option',
3 Experiment = 'experiment',
4 Ignore = 'ignore',
5 Deprecated = 'deprecated',
6 InternalKillSwitch = 'internalKillSwitch',
7}
8
9export enum OptionContext {
10 Options = 'options',
11 Experiments = 'experiments',
12 Internal = 'internal',
13 Deprecated = 'deprecated',
14}
15
16export interface OptionConfig<T> {
17 codename: string;
18 context: OptionContext;
19 defaultValue: T;
20 killSwitchType: KillSwitchType;
21 optionalPermissions?: string[];
22}
23
24export class Option<T> implements OptionConfig<T> {
25 public codename: string;
26 public context: OptionContext;
27 public defaultValue: T;
28 public killSwitchType: KillSwitchType;
29 public optionalPermissions: string[];
30
31 constructor(config: OptionConfig<T>) {
32 this.codename = config.codename;
33 this.context = config.context;
34 this.defaultValue = config.defaultValue;
35 this.killSwitchType = config.killSwitchType;
36 this.optionalPermissions = config.optionalPermissions ?? [];
37 }
38}