namespace SpaceGame.Api.Universe.Contracts;

public sealed record WorldSnapshot(
  string Label,
  int Seed,
  long Sequence,
  int TickIntervalMs,
  double OrbitalTimeSeconds,
  OrbitalSimulationSnapshot OrbitalSimulation,
  DateTimeOffset GeneratedAtUtc,
  IReadOnlyList<SystemSnapshot> Systems,
  IReadOnlyList<CelestialSnapshot> Celestials,
  IReadOnlyList<ResourceNodeSnapshot> Nodes,
  IReadOnlyList<StationSnapshot> Stations,
  IReadOnlyList<ClaimSnapshot> Claims,
  IReadOnlyList<ConstructionSiteSnapshot> ConstructionSites,
  IReadOnlyList<MarketOrderSnapshot> MarketOrders,
  IReadOnlyList<PolicySetSnapshot> Policies,
  IReadOnlyList<ShipSnapshot> Ships,
  IReadOnlyList<FactionSnapshot> Factions,
  GeopoliticalStateSnapshot? Geopolitics);

public sealed record WorldDelta(
  long Sequence,
  int TickIntervalMs,
  double OrbitalTimeSeconds,
  OrbitalSimulationSnapshot OrbitalSimulation,
  DateTimeOffset GeneratedAtUtc,
  bool RequiresSnapshotRefresh,
  IReadOnlyList<SimulationEventRecord> Events,
  IReadOnlyList<CelestialDelta> Celestials,
  IReadOnlyList<ResourceNodeDelta> Nodes,
  IReadOnlyList<StationDelta> Stations,
  IReadOnlyList<ClaimDelta> Claims,
  IReadOnlyList<ConstructionSiteDelta> ConstructionSites,
  IReadOnlyList<MarketOrderDelta> MarketOrders,
  IReadOnlyList<PolicySetDelta> Policies,
  IReadOnlyList<ShipDelta> Ships,
  IReadOnlyList<FactionDelta> Factions,
  GeopoliticalStateSnapshot? Geopolitics,
  ObserverScope? Scope = null);

public sealed record SimulationEventRecord(
  string EntityKind,
  string EntityId,
  string Kind,
  string Message,
  DateTimeOffset OccurredAtUtc,
  string Family = "simulation",
  string ScopeKind = "universe",
  string? ScopeEntityId = null,
  string Visibility = "public");

public sealed record ObserverScope(
  string ScopeKind,
  string? SystemId = null,
  string? CelestialId = null);

public sealed record OrbitalSimulationSnapshot(
  double SimulatedSecondsPerRealSecond);
