1import { ComponentType } from 'react';
2import { LoadingState } from '@grafana/data';
3
4import { initialVariableModelState, SystemVariable, VariableHide } from '../types';
5import { VariableAdapter } from '../adapters';
6import { VariablePickerProps } from '../pickers/types';
7import { VariableEditorProps } from '../editor/types';
8
9export const createSystemVariableAdapter = (): VariableAdapter<SystemVariable<any>> => {
10  return {
11    id: 'system',
12    description: '',
13    name: 'system',
14    initialState: {
15      ...initialVariableModelState,
16      type: 'system',
17      hide: VariableHide.hideVariable,
18      skipUrlSync: true,
19      current: { value: { toString: () => '' } },
20      state: LoadingState.Done,
21    },
22    reducer: (state: any, action: any) => state,
23    picker: (null as unknown) as ComponentType<VariablePickerProps<SystemVariable<any>>>,
24    editor: (null as unknown) as ComponentType<VariableEditorProps<SystemVariable<any>>>,
25    dependsOn: () => {
26      return false;
27    },
28    setValue: async (variable, option, emitChanges = false) => {
29      return;
30    },
31    setValueFromUrl: async (variable, urlValue) => {
32      return;
33    },
34    updateOptions: async (variable) => {
35      return;
36    },
37    getSaveModel: (variable) => {
38      return {};
39    },
40    getValueForUrl: (variable) => {
41      return '';
42    },
43  };
44};
45