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

export const TerminatorsIF = (leg: IFTerminalEntry, waypoint?: Waypoint): NavFix => {
  const targetFix: NavFix = {
    latitude: leg.WptLat,
    longitude: leg.WptLon,
    name: waypoint?.Ident ?? undefined,
    isFlyOver: leg.IsFlyOver,
    altitude: leg.Alt ? leg.Alt.parseAltitude() : 0,
    speed: leg.SpeedLimit ? leg.SpeedLimit : Parser.AC_SPEED,
    speedConstraint: leg.SpeedLimit,
    altitudeConstraint: leg.Alt,
  };

  return targetFix;
};
