using System;
namespace ProjectM.Simulation
{
/// One serialized ledger row (item id + count). An array FIELD of .
[Serializable]
public struct LedgerRow
{
public int ItemId;
public int Count;
}
/// One persisted per-class PERMANENT meta-upgrade tier (v6). ClassId = the normalized FrameKind
/// (Bathynaut=2/Harpooner=3); UpgradeId = the append-only meta-catalog key (unknown ids round-trip preserved and are
/// skipped live); Tier clamps to the catalog's MaxTier at seed/shop/spend, never at rest.
[Serializable]
public struct MetaUpgradeSave
{
public byte ClassId;
public byte UpgradeId;
public byte Tier;
}
/// One serialized player-built structure. Flat scalars (JsonUtility has no int2).
[Serializable]
public struct StructureSave
{
public byte Type;
public int CellX;
public int CellZ;
public float HP; // EB-1: hit points at save time (0 -> restored to baked Max)
}
///
/// Versioned, host-authoritative save slice: the shared resource ledger + player-built structures + the
/// permanent meta. JsonUtility-friendly — a class with flat fields and an array FIELD (never a root array).
/// The schema is ADDITIVE going forward, gated by migration.
///
[Serializable]
public class SaveData
{
public const int CurrentVersion = 7; // v7: LANTERN fresh epoch — goal/core/outcome + conveyor/machine-I/O fields dropped
/// Oldest save schema the loader accepts. v7 is a FRESH EPOCH (operator-approved): older saves are ignored.
public const int MinLoadableVersion = 7;
public int Version = CurrentVersion;
// Permanent meta-progression:
public int RunsCompleted; // boss-cleared runs (the HUD counter + the HostSalt fold at restore)
public int MaxDepthReached; // deepest room actually CLEARED across all runs (honest depth, never planned)
public MetaUpgradeSave[] MetaUpgrades = Array.Empty(); // sparse per-class tiers
public LedgerRow[] Ledger = Array.Empty();
public StructureSave[] Structures = Array.Empty();
public long SavedAtMs;
}
}