Mega 2560 WiFi - error: 'PinStatus' does not name a type

I think the error means that you are using the wrong WiFi library for your board. There is no "Arduino" with an ATmega2560 and ESP8266. I think you will have to treat the ESP826 as a 'shield'.

This project uses an ESP8266 module connected to an Arduino MEGA 2560 via Serial1. It can probably be adapted to your hardware:

https://create.arduino.cc/projecthub/Topocalma/esp8266-arduino-wifi-shield-for-windows-255407