type PuzPos
{
	i8 X
	i8 Y
}

type ElemPos
{
	PuzPos Position
	u8     ElemIdx
}

enum PuzzleElementType(u8)
{
	None           GameName("Empty")              ShortName("  ")
	WaterIn        GameName("Water Source")       ShortName("~+")
	WaterGoal      GameName("Water Goal")         ShortName("~-")
	WaterChannel   GameName("Water Channel")      ShortName("~")
	ElectricIn     GameName("Electricity Source") ShortName("e+")
	ElectricGoal   GameName("Electricity Goal")   ShortName("e-")
	Blocked        GameName("Blocked")            ShortName("B")
	Bridge         GameName("Bridge")             ShortName("#")
}

type PuzzleNode
{
	PuzzleElementType PlacedTypes Arr(4)
}

type StaticPuzzleCard
{
	PuzzleNode Nodes        Arr(4)
	u16        ModelHandle
}

type StaticPuzzleCardHandle
{
	u16 Idx Default("UINT16_MAX")
}

type StaticPuzzleData
{
	StaticPuzzleCard Cards Arr(64)
}

type PuzzleCardStack
{
	StaticPuzzleCardHandle RefCard
	u8                     MaxAvailableCount
	u8                     UsedCount
}

type PlacedPuzzleCard
{
	StaticPuzzleCardHandle RefCard
	PuzPos                 Position
	u8                     Rotation
	b                      IsLocked
}

type PuzzleData
{
	u8               WidthTiles
	u8               HeightTiles
	u32              AvailableCardCount
	PuzzleCardStack  AvailableCards      Arr(16)
	u32              PlacedCardCount
	PlacedPuzzleCard PlacedCards         Arr(256)
	PuzzleNode       PlacedNodes         Arr(1024)
	u32              GoalPositionCount
	ElemPos          GoalPositions       Arr(16)
	str              PuzzleName          Arr(64)
}
