package calc

import "galaxy/calc"

// This file bridges the inverse ("goal-seek") solvers from
// `pkg/calc/solve.go`. The ship-class calculator lets a player pin one
// derived result and back-solve the single input it claims; each wrapper
// is a one-line passthrough so the inverse math stays in `pkg/calc`. Every
// solver returns ok == false when the request is infeasible.

// WeaponsForAttack wraps `calc.WeaponsForAttack`: the weapons block that
// yields targetAttack at weapons tech weaponsTech.
func WeaponsForAttack(targetAttack, weaponsTech float64) (float64, bool) {
	return calc.WeaponsForAttack(targetAttack, weaponsTech)
}

// DriveForSpeed wraps `calc.DriveForSpeed`: the drive block that yields
// targetSpeed for a ship whose mass excluding the drive block is restMass,
// at drive tech driveTech.
func DriveForSpeed(targetSpeed, driveTech, restMass float64) (float64, bool) {
	return calc.DriveForSpeed(targetSpeed, driveTech, restMass)
}

// ShieldsForDefence wraps `calc.ShieldsForDefence`: the shields block that
// yields targetDefence for a ship whose mass excluding the shields block
// is restMass, at shields tech shieldsTech.
func ShieldsForDefence(targetDefence, shieldsTech, restMass float64) (float64, bool) {
	return calc.ShieldsForDefence(targetDefence, shieldsTech, restMass)
}

// CargoForEmptyMass wraps `calc.CargoForEmptyMass`: the cargo block that
// brings empty mass to targetEmptyMass given restMass, the mass of the
// other blocks.
func CargoForEmptyMass(targetEmptyMass, restMass float64) (float64, bool) {
	return calc.CargoForEmptyMass(targetEmptyMass, restMass)
}

// LoadForFullMass wraps `calc.LoadForFullMass`: the cargo load that brings
// full mass to targetFullMass given the ship's empty mass and cargo tech.
func LoadForFullMass(targetFullMass, emptyMass, cargoTech float64) (float64, bool) {
	return calc.LoadForFullMass(targetFullMass, emptyMass, cargoTech)
}
