#pragma once

#include <Arduino.h>
#include <Preferences.h>

struct WifiMqttConfig {
  String ssid;
  String password;
  String mqtt_host;
  uint16_t mqtt_port;
  String mqtt_user;
  String mqtt_pass;
  String ntp_server_1;
  String ntp_server_2;
  String web_user;
  String web_pass;
  bool valid;
};

void wifi_manager_init();
bool wifi_load_config(WifiMqttConfig &config);
bool wifi_save_config(const WifiMqttConfig &config);

bool wifi_connect_sta(const WifiMqttConfig &config, uint32_t timeout_ms = 10000);
void wifi_start_ap(const char *ap_ssid, const char *ap_pass);
bool wifi_is_connected();
String wifi_get_ssid();
