import Parser from '../parser.ts';

export const computeSpeed = (leg: TerminalEntry, previousFix: NavFix) => {
  if (leg.SpeedLimit) return leg.SpeedLimit;
  if (previousFix.speed) {
    if (previousFix.speed < Parser.AC_SPEED) return Parser.AC_SPEED;

    return previousFix.speed;
  }

  return Parser.AC_SPEED;
};
