#ifndef CONFIG_HPP
#define CONFIG_HPP

#include <string>
#include <vector>
#include <filesystem>

namespace simple_object_storage {

struct ServerConfig {
    std::vector<std::string> write_tokens;
    std::filesystem::path object_store_path = "/data/storage";
    std::string host = "0.0.0.0";
    uint16_t port = 80;

    // CORS configuration
    std::vector<std::string> allowed_origins = {"*"};  // Default to allow all origins
    std::vector<std::string> allowed_methods = {"GET", "PUT", "POST", "DELETE", "OPTIONS"};
    std::vector<std::string> allowed_headers = {"Authorization", "Content-Type"};
    bool allow_credentials = false;
    
    // Rate limiting configuration
    int auth_rate_limit = 5;  // Maximum number of auth attempts
    int auth_window_seconds = 300;  // Time window in seconds (5 minutes)
    
    // Logging configuration
    std::filesystem::path log_file_path = "/data/sos.log";  // Path to log file (empty string disables file logging)
    std::string log_level = "info";  // Log level: trace, debug, info, warn, error, critical
};

bool load_config(const std::string& config_path, ServerConfig& config);

} // namespace simple_object_storage

#endif 