// all possible input types for the widget settings
export type EditorInputTypes =
  | "text"
  | "number"
  | "checkbox"
  | "switch"
  | "multiselect"
  | "select"

export type EditorSettings = {
  inputType: EditorInputTypes
  min?: number
  max?: number
  step?: number
  selectionValues?: string[]
}

export type VuePropType =
  | StringConstructor
  | NumberConstructor
  | BooleanConstructor
  | ArrayConstructor
  | ObjectConstructor
  | Function

export type WidgetConf = {
  [key: string]: {
    type: VuePropType
    default: string | number | boolean | Function
    editor: EditorSettings
  }
}

export type OnAllWidgetsReady = (callback: () => void) => void

export type ConfigurableParameters = Record<
  string,
  EditorSettings & { defaultValue: any }
>

export type RegisteredWidgetDeclaration = {
  pluginKey: string
  author: string
  title: string
  color: string
  icon: string
  images: string[]
  description: string
  configurableParameters?: ConfigurableParameters
  name: string
}

export type WidgetDeclaration = Omit<
  RegisteredWidgetDeclaration,
  "pluginKey" | "author" | "name" // name will be extracted via filename, cannot be overwritten
> & {
  title: string
  description?: string
  color?: string
  icon?: string
  images?: string[]
}
