namespace Chessistics.Engine.Model;
///
/// Deep copy of every mutable field needed to restore a BoardState to an
/// earlier point. Used by QuickSave/QuickLoad for rapid iteration during
/// UI/UX testing and by the harness to restore checkpoints.
///
/// Immutable refs (defs, CampaignDef) are shared; mutable state (Pieces,
/// DemandState, buffers, stock, campaign progression) is copied by value.
///
public sealed class WorldSave
{
public int Width { get; init; }
public int Height { get; init; }
public CellType[,] Grid { get; init; } = new CellType[0, 0];
public SimPhase Phase { get; init; }
public int TurnNumber { get; init; }
public int NextPieceId { get; init; }
public Dictionary Productions { get; init; } = new();
public Dictionary ProductionBuffers { get; init; } = new();
public Dictionary Demands { get; init; } = new();
public Dictionary Transformers { get; init; } = new();
public Dictionary TransformerInputBuffers { get; init; } = new();
public Dictionary TransformerOutputBuffers { get; init; } = new();
public List Pieces { get; init; } = new();
public List DestroyedPieces { get; init; } = new();
public Dictionary RemainingStock { get; init; } = new();
public HashSet OccupiedCells { get; init; } = new();
public CampaignSaveData? Campaign { get; init; }
}
public sealed class CampaignSaveData
{
public int CurrentMissionIndex { get; init; }
public List CompletedMissions { get; init; } = new();
public HashSet AvailablePieceKinds { get; init; } = new();
public HashSet AvailableLevels { get; init; } = new();
}