import type { GalaxyConnection, GalaxySystem, Vec3 } from "../shared/types";

export type LocalEntity = {
  id: string;
  name: string;
  type: string;
  x: number;
  y: number;
  distance?: number;
};

export type LocalWaypoint = {
  id: string;
  name: string;
  type: "manual" | "entity" | "poi";
  position: Vec3;
  systemId?: string;
  poiId?: string;
  followOrbit?: boolean;
  arrived?: boolean;
};

export type MovementState = {
  systems: GalaxySystem[];
  connections: GalaxyConnection[];
  currentSystemId: string;
  shipPosition: Vec3;
  shipSpeed: number;
  localEntities: LocalEntity[];
  localWaypoints: LocalWaypoint[];
  arrivalMessage: string | null;
};

export const createMovementState = (systems: GalaxySystem[], connections: GalaxyConnection[], localEntities: LocalEntity[]): MovementState => ({
  systems,
  connections,
  currentSystemId: "sol",
  shipPosition: [0, 0, 0],
  shipSpeed: 0,
  localEntities,
  localWaypoints: [],
  arrivalMessage: null,
});
