import type { Ship, VesselAnalysisDto } from '../../types';
import type { MemberInfo } from '../../services/vesselAnalysis';

// ── 히스토리 스냅샷 + 보간 플래그 ──
export type HistoryFrame = GroupPolygonDto & { _interp?: boolean; _longGap?: boolean };

// ── 외부 노출 타입 (KoreaMap에서 import) ──
export interface SelectedGearGroupData {
  parent: Ship | null;
  gears: Ship[];
  groupName: string;
}

export interface SelectedFleetData {
  clusterId: number;
  ships: Ship[];
  companyName: string;
}

// ── 내부 공유 타입 ──
export interface HoverTooltipState {
  lng: number;
  lat: number;
  type: 'fleet' | 'gear';
  id: number | string;
}

export interface PickerCandidate {
  name: string;
  count: number;
  inZone: boolean;
  isFleet: boolean;
  clusterId?: number;
}

export interface GearPickerPopupState {
  lng: number;
  lat: number;
  candidates: PickerCandidate[];
}

export interface FleetListItem {
  id: number;
  mmsiList: string[];
  label: string;
  memberCount: number;
  areaSqNm: number;
  color: string;
  members: MemberInfo[];
}

// ── 상수 ──
export const GEAR_BUFFER_DEG = 0.01;
export const CIRCLE_SEGMENTS = 16;
export const TIMELINE_DURATION_MS = 12 * 60 * 60_000; // 12시간
export const PLAYBACK_CYCLE_SEC = 30; // 30초에 12시간 전체 재생
export const TICK_MS = 50; // 50ms 간격 업데이트
export const EMPTY_ANALYSIS = new globalThis.Map<string, VesselAnalysisDto>();
