import type { BasicWidgetInstance, BasicWidgetProps } from '../../utils'

export interface OptionItem {
    // 颜色
    color?: string
    // 图标
    icon?: string
    // 标签
    label?: string
    // 多子项
    items?: OptionItem[]
}

export interface Option {
    // 选项
    items: OptionItem[] | OptionItem[][]
    // label 样式
    labelStyle?: Recordable
    // 色块样式
    blockStyle?: Recordable
}

export interface LegendProps extends BasicWidgetProps {
    // 是否展开
    expand?: boolean
    // 标题
    title: string
    // 选项
    option: Option
}

export interface LegendInstance extends BasicWidgetInstance<LegendProps> {
    setTitle: (title: string) => void
    setOption: (option: Option) => void
    toggleExpand: (expand?: boolean) => void
}
