import {ComponentClass} from 'react'
import {ComponentType} from 'react'
import {FunctionComponent} from 'react'
import {Plugin as Plugin_2} from 'sanity'
import {default as React_2} from 'react'

export declare interface DashboardConfig {
  widgets: DashboardWidget[]
  layout?: LayoutConfig
}

export declare interface DashboardPluginConfig {
  /**
   * Dashboard tool title
   */
  title?: string
  /**
   * Dashboard tool name (used in url path)
   */
  name?: string
  /**
   * Dashboard tool icon
   */
  icon?: ComponentType
  widgets?: DashboardWidget[]
  /**
   * Will be used for widgets that do not define a layout directly.
   */
  defaultLayout?: LayoutConfig
}

export declare const dashboardTool: Plugin_2<DashboardPluginConfig>

export declare interface DashboardWidget {
  name: string
  type?: '__experimental_group'
  component: FunctionComponent<any> | ComponentClass<any>
  layout?: LayoutConfig
  widgets?: DashboardWidget[]
}

export declare const DashboardWidgetContainer: React_2.ForwardRefExoticComponent<
  DashboardWidgetProps & React_2.RefAttributes<HTMLDivElement>
>

declare interface DashboardWidgetProps {
  header?: string
  children: React_2.ReactNode
  footer?: React_2.ReactNode
}

export declare interface LayoutConfig {
  width?: LayoutSize
  height?: LayoutSize
}

export declare type LayoutSize = 'auto' | 'small' | 'medium' | 'large' | 'full'

export declare function projectInfoWidget(config?: {layout?: LayoutConfig}): DashboardWidget

export declare function projectUsersWidget(config?: {layout?: LayoutConfig}): DashboardWidget

export declare function sanityTutorialsWidget(config?: {layout?: LayoutConfig}): DashboardWidget

export {}
