package flow

func (f *Flow) linkBridge() {
	// FIXME: sometimes these doors are frozen, depending on game state

	f.onClick(bridge, "2.1", f.setDriver(briefing)) // TODO: Mission briefing clickable
	f.onClick(bridge, "2.2", f.setDriver(choices))  // Options door hotspot
	f.setFreeze(bridge, "2.4", false)               // FIXME: Enter combat door hotspot (!!!)
	f.setFreeze(bridge, "2.6", false)               // FIXME: Vehicle configure door hotspot
	f.onClick(bridge, "2.8", f.setDriver(arrange))  // Squads configure door hotspot

	// link children
	f.linkBriefing()
	f.linkChoices()
	f.linkArrange()
}

func (f *Flow) linkBriefing() {
	f.onClick(briefing, "3.1", f.setDriver(bridge))
}

func (f *Flow) linkChoices() {
	f.onClick(choices, "2.1", f.setDriver(loadGame))                  // Load another game button
	f.onClick(choices, "2.2", f.setDriver(saveGame))                  // Save this game button
	f.onClick(choices, "2.3", f.setReturningDriver(choices, options)) // More options button

	// FIXME: wipe out game state when this goes through
	f.onClick(choices, "2.4", f.setDriver(main)) // Restart button

	f.onClick(choices, "2.5", f.setDriver(credits)) // Credits button
	f.onClick(choices, "2.6", f.setExit)            // Quit button
	f.onClick(choices, "2.7", f.setDriver(bridge))  // Back button
}

func (f *Flow) linkArrange() {
	// FIXME: we should be operating on game data in here
	f.onClick(arrange, "8.1", f.setDriver(bridge))            // Return to bridge ("cathedral")
	f.onClick(arrange, "8.3", f.setDriver(configureUltEquip)) // Configure squads

	f.linkConfigureUltEquip()
}

func (f *Flow) linkConfigureUltEquip() {
	// FIXME: we should be modifying loadouts of selected squad members here

	f.onClick(configureUltEquip, "8.1", f.setDriver(bridge)) // Return to bridge
}
