type PuzPos
{
	i8 X
	i8 Y
}

type ElemPos
{
	PuzPos Position
	u8     ElemIdx
}

enum PuzzleElementType(u8)
{
	None           GameName("Empty")
	WaterIn        GameName("Water Source")
	WaterGoal      GameName("Water Goal")
	WaterChannel   GameName("Water Channel")
	ElectricIn     GameName("Electricity Source")
	ElectricGoal   GameName("Electricity Goal")
	Blocked        GameName("Blocked")
	Bridge         GameName("Bridge")
}

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)
}
