import type {
  ClaimDelta,
  ClaimSnapshot,
  ConstructionSiteDelta,
  ConstructionSiteSnapshot,
} from "./contractsInfrastructure";
import type {
  FactionDelta,
  FactionSnapshot,
} from "./contractsFactions";
import type {
  CelestialDelta,
  CelestialSnapshot,
  ResourceNodeDelta,
  ResourceNodeSnapshot,
  SystemSnapshot,
} from "./contractsCelestial";
import type {
  MarketOrderDelta,
  PolicySetDelta,
  PolicySetSnapshot,
  MarketOrderSnapshot,
} from "./contractsEconomy";
import type { GeopoliticalStateSnapshot } from "./contractsGeopolitics";
import type {
  ShipDelta,
  ShipSnapshot,
} from "./contractsShips";

export interface WorldSnapshot {
  label: string;
  seed: number;
  sequence: number;
  tickIntervalMs: number;
  orbitalTimeSeconds: number;
  orbitalSimulation: OrbitalSimulationSnapshot;
  generatedAtUtc: string;
  systems: SystemSnapshot[];
  celestials: CelestialSnapshot[];
  nodes: ResourceNodeSnapshot[];
  stations: import("./contractsInfrastructure").StationSnapshot[];
  claims: ClaimSnapshot[];
  constructionSites: ConstructionSiteSnapshot[];
  marketOrders: MarketOrderSnapshot[];
  policies: PolicySetSnapshot[];
  ships: ShipSnapshot[];
  factions: FactionSnapshot[];
  geopolitics?: GeopoliticalStateSnapshot | null;
}

export interface WorldDelta {
  sequence: number;
  tickIntervalMs: number;
  orbitalTimeSeconds: number;
  orbitalSimulation: OrbitalSimulationSnapshot;
  generatedAtUtc: string;
  requiresSnapshotRefresh: boolean;
  events: SimulationEventRecord[];
  celestials: CelestialDelta[];
  nodes: ResourceNodeDelta[];
  stations: import("./contractsInfrastructure").StationDelta[];
  claims: ClaimDelta[];
  constructionSites: ConstructionSiteDelta[];
  marketOrders: MarketOrderDelta[];
  policies: PolicySetDelta[];
  ships: ShipDelta[];
  factions: FactionDelta[];
  geopolitics?: GeopoliticalStateSnapshot | null;
  scope?: ObserverScope | null;
}

export interface SimulationEventRecord {
  entityKind: string;
  entityId: string;
  kind: string;
  message: string;
  occurredAtUtc: string;
  family?: string;
  scopeKind?: string;
  scopeEntityId?: string | null;
  visibility?: string;
}

export interface ObserverScope {
  scopeKind: string;
  systemId?: string | null;
  celestialId?: string | null;
}

export interface OrbitalSimulationSnapshot {
  simulatedSecondsPerRealSecond: number;
}
