import Gantt from 'frappe-gantt';

import { PopoverProps } from '../Popover';

/* eslint-disable @typescript-eslint/ban-types */
export interface GanttTask<T extends object> extends Gantt.Task {
  source: T;
}

export interface GanttChartProps<T extends object> {
  popover?: {
    content: (task?: GanttTask<T>) => PopoverProps['children'];
    className?: PopoverProps['className'];
    style?: PopoverProps['style'];
    anchorOrigin?: PopoverProps['anchorOrigin'];
    transformOrigin?: PopoverProps['transformOrigin'];
  };
  dateFormat?: Gantt.Options['date_format'];
  language?: 'en' | 'ru' | 'it';
  marginBottom?: number;
  onClick: Gantt.Options['on_click'];
  onDateChange: (task: GanttTask<T>, start: Date, end: Date) => void;
  onProgressChange?: Gantt.Options['on_progress_change'];
  onTasksChange?: (tasks: GanttTask<T>[]) => void;
  onViewChange?: Gantt.Options['on_view_change'];
  tasks: GanttTask<T>[];
  viewMode: Gantt.viewMode;
}
