@INVISIBLE - thanks for the extra detail, that narrows it down nicely. With a 2022 AllTrail 5 out of warranty, here's where I'd go next.
The key thing: charging working doesn't prove the battery can deliver power. Charging and discharge run through separate circuitry in the battery's management system, so full green lights on charge can coexist with a dead output. That's the first thing to rule in or out:
• If you've got a multimeter (or a mate with one), check for voltage at the battery's main discharge contacts with it switched on - you'd want to see somewhere around 36 - 42V depending on charge. No voltage there = battery BMS fault, and the rest of the bike is innocent
• If there IS voltage at the contacts, the fault moves downstream - wiring or the switch itself
The side switch is a known weak point. Since yours is showing absolutely nothing - no LEDs, no flicker - and the battery seems healthy, the handlebar switch unit is a prime suspect. They live out in the weather and water ingress does for them eventually. Worth:
• Unplugging its connector (usually follows the cable down to the motor area), checking for green corrosion or moisture, and giving it a clean with contact cleaner
• Checking the cable for chafe damage where it runs around the headtube - a common spot for it to wear through
Replacement Yamaha switch units are available as spares and they're one of the cheaper bits of the system to swap, so if the battery checks out it's a sensible punt before anything drastic.
If neither sorts it - a Haibike or Yamaha dealer with the diagnostic tool can interrogate the system properly and tell you whether it's switch, wiring or motor controller, which beats replacing parts on guesswork. Out of warranty it'll cost you a diagnostic fee, but far less than a wrong part.
Similar pattern crops up on other systems too -
@RickBullotta's post on connector corrosion killing power-up is worth a read. Let us know what the multimeter says and we can narrow it further.