package flow

func (f *Flow) linkBridge() {
	// FIXME: sometimes these doors are frozen, depending on ship state, but we
	// don't implement that yet.

	f.onClick(bridge, "2.1", f.setReturningDriver(bridge, briefing)) // Mission briefing clickable
	f.onClick(bridge, "2.2", f.setReturningDriver(bridge, choices))  // Options door hotspot
	f.onClick(bridge, "2.4", f.playNextScenario(bridge))             // Enter combat door hotspot
	f.setFreeze(bridge, "2.6", true)                                 // TODO: Vehicle configure door hotspot

	// FIXME: setReturningDriver would leave behind junk
	f.onClick(bridge, "2.8", f.setDriver(arrange)) // Squads configure door hotspot.

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

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

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
}
