/** Minimalní deklarace pro build bez nainstalovaných typů / modulů chart.js. */
declare module 'chart.js' {
  export type ChartArea = {
    left: number
    right: number
    top: number
    bottom: number
    width: number
    height: number
  }

  export type TooltipItem<_T = unknown> = {
    dataIndex: number
    dataset: { label?: string; yAxisID?: string }
    parsed: { y: number }
  }

  export interface Chart {
    chartArea: ChartArea
    ctx: CanvasRenderingContext2D
    data: {
      labels?: unknown[]
      datasets?: Array<{ hidden?: boolean; label?: string; yAxisID?: string; [key: string]: unknown }>
    }
    destroy(): void
    resize(): void
    update(mode?: string): void
  }

  export type Plugin<_T = Chart> = {
    id: string
    beforeDatasetsDraw?(chart: Chart): void
    afterDatasetsDraw?(chart: Chart): void
  }
}

declare module 'chart.js/auto' {
  import type { Chart } from 'chart.js'

  export class Chart {
    constructor(ctx: unknown, config: unknown)
    chartArea: Chart['chartArea']
    data: Chart['data']
    ctx: Chart['ctx']
    destroy(): void
    resize(): void
    update(mode?: string): void
  }
}
