#include <iostream>
#include <string>
#include "connector_controller.h"
#include "connector_database.h"

int main() {
    std::string command;
    bool running = true;

    while (running) {
        std::cout << "Enter command (start_http_server/connect_gateway/database_operation/exit): ";
        std::cin >> command;

        if (command == "start_http_server") {
            StartHttpServer();
        } else if (command == "connect_gateway") {
            std::string ip;
            int port;
            std::cout << "Enter the gateway IP address: "<<std::endl;
            std::cin>>ip; // 使用getline以获取包含空格的IP地址
            std::cout << "Enter the gateway port: "<<std::endl;
            std::cin >> port;
            ConnectToGateway(ip, port);
        } else if (command == "database_operation") {
            DatabaseOperation();
        } else if (command == "exit") {
            running = false;
        } else {
            std::cout << "Unknown command" << std::endl;
        }
    }

    std::cout << "Exiting program." << std::endl;
    return 0;
}