/**
 * DragTypes - Event payloads for drag-drop operations
 */

import { SwpEvent } from './SwpEvent';

export interface IMousePosition {
  x: number;
  y: number;
}

export interface IDragStartPayload {
  eventId: string;
  element: HTMLElement;         // Original element (being dragged)
  ghostElement: HTMLElement;    // Ghost clone (stays in place)
  startY: number;               // Original Y position
  mouseOffset: IMousePosition;  // Click position within element
  columnElement: HTMLElement;
}

export interface IDragMovePayload {
  eventId: string;
  element: HTMLElement;
  currentY: number;             // Interpolated Y position (smooth)
  columnElement: HTMLElement;
}

export interface IDragEndPayload {
  swpEvent: SwpEvent;           // Wrapper with element, start, end, eventId, columnKey
  sourceColumnKey: string;      // Source column key (where drag started)
  target: 'grid' | 'header';    // Where the event was dropped
}

export interface IDragCancelPayload {
  eventId: string;
  element: HTMLElement;
  startY: number;               // Position to animate back to
}

export interface IDragColumnChangePayload {
  eventId: string;
  element: HTMLElement;
  previousColumn: HTMLElement;
  newColumn: HTMLElement;
  currentY: number;
}

// Header drag payloads
export interface IDragEnterHeaderPayload {
  eventId: string;
  element: HTMLElement;        // Original dragged element
  sourceColumnIndex: number;
  sourceColumnKey: string;     // Opaque column identifier (for matching only)
  title: string;
  colorClass?: string;
  itemType: 'event' | 'reminder';
  duration: number;            // Antal dage (default 1)
}

export interface IDragMoveHeaderPayload {
  eventId: string;
  columnIndex: number;
  columnKey: string;           // Opaque column identifier (for matching only)
}

export interface IDragLeaveHeaderPayload {
  eventId: string;
  source: 'grid' | 'header';     // Where drag originated
  // Header→grid fields (when source === 'header')
  element?: HTMLElement;         // Header item element
  targetColumn?: HTMLElement;    // Target column in grid
  start?: Date;                  // Event start from header item
  end?: Date;                    // Event end from header item
  title?: string;
  colorClass?: string;
}
