namespace SpaceGame.Api.Stations.Contracts;

public sealed record InventoryEntry(
  string ItemId,
  float Amount);

public sealed record StationSnapshot(
  string Id,
  string Label,
  string Category,
  string Objective,
  string SystemId,
  Vector3Dto LocalPosition,
  string? CelestialId,
  string Color,
  int DockedShips,
  IReadOnlyList<string> DockedShipIds,
  int DockingPads,
  IReadOnlyList<StationActionProgressSnapshot> CurrentProcesses,
  IReadOnlyList<InventoryEntry> Inventory,
  string FactionId,
  string? CommanderId,
  string? PolicySetId,
  float Population,
  float PopulationCapacity,
  float WorkforceRequired,
  float WorkforceEffectiveRatio,
  IReadOnlyList<StationStorageUsageSnapshot> StorageUsage,
  IReadOnlyList<string> InstalledModules,
  IReadOnlyList<string> MarketOrderIds);

public sealed record StationDelta(
  string Id,
  string Label,
  string Category,
  string Objective,
  string SystemId,
  Vector3Dto LocalPosition,
  string? CelestialId,
  string Color,
  int DockedShips,
  IReadOnlyList<string> DockedShipIds,
  int DockingPads,
  IReadOnlyList<StationActionProgressSnapshot> CurrentProcesses,
  IReadOnlyList<InventoryEntry> Inventory,
  string FactionId,
  string? CommanderId,
  string? PolicySetId,
  float Population,
  float PopulationCapacity,
  float WorkforceRequired,
  float WorkforceEffectiveRatio,
  IReadOnlyList<StationStorageUsageSnapshot> StorageUsage,
  IReadOnlyList<string> InstalledModules,
  IReadOnlyList<string> MarketOrderIds);

public sealed record StationActionProgressSnapshot(
  string Lane,
  string Label,
  float Progress,
  float TimeRemainingSeconds,
  float CycleSeconds,
  IReadOnlyList<RecipeEntrySnapshot> Inputs,
  IReadOnlyList<RecipeEntrySnapshot> Outputs);

public sealed record RecipeEntrySnapshot(string ItemId, float Amount);

public sealed record StationStorageUsageSnapshot(
  string StorageClass,
  float Used,
  float Capacity);

public sealed record ClaimSnapshot(
  string Id,
  string FactionId,
  string SystemId,
  string CelestialId,
  string State,
  float Health,
  DateTimeOffset PlacedAtUtc,
  DateTimeOffset ActivatesAtUtc);

public sealed record ClaimDelta(
  string Id,
  string FactionId,
  string SystemId,
  string CelestialId,
  string State,
  float Health,
  DateTimeOffset PlacedAtUtc,
  DateTimeOffset ActivatesAtUtc);

public sealed record ConstructionSiteSnapshot(
  string Id,
  string FactionId,
  string SystemId,
  string CelestialId,
  string TargetKind,
  string TargetDefinitionId,
  string? BlueprintId,
  string? ClaimId,
  string? StationId,
  string State,
  float Progress,
  IReadOnlyList<InventoryEntry> Inventory,
  IReadOnlyList<InventoryEntry> RequiredItems,
  IReadOnlyList<InventoryEntry> DeliveredItems,
  IReadOnlyList<string> AssignedConstructorShipIds,
  IReadOnlyList<string> MarketOrderIds);

public sealed record ConstructionSiteDelta(
  string Id,
  string FactionId,
  string SystemId,
  string CelestialId,
  string TargetKind,
  string TargetDefinitionId,
  string? BlueprintId,
  string? ClaimId,
  string? StationId,
  string State,
  float Progress,
  IReadOnlyList<InventoryEntry> Inventory,
  IReadOnlyList<InventoryEntry> RequiredItems,
  IReadOnlyList<InventoryEntry> DeliveredItems,
  IReadOnlyList<string> AssignedConstructorShipIds,
  IReadOnlyList<string> MarketOrderIds);
