#pragma once
#include <cstddef>
#include <filesystem>
#include <optional>
#include <string>
#include <vector>
#include <mw/error.hpp>
#include "service_config.h"
/// A group of services displayed together in the web UI.
struct ServiceGroupConfig
{
/// Group name shown in the web UI.
std::string name;
/// Service definitions in configuration order.
std::vector<ServiceConfig> services;
};
/// Application settings represented independently of the configuration format.
struct Configuration
{
/// Positive number of probe worker threads.
std::size_t worker_count = 0;
/// Path to the SQLite database used for status history.
std::string database_path;
/// Service groups in configuration order.
std::vector<ServiceGroupConfig> groups;
/// Unix-domain socket path; empty selects the default TCP listener.
std::string unix_socket;
/// Permission bits applied to the Unix-domain socket, when configured.
std::optional<unsigned int> socket_permission;
/// Load and validate a YAML configuration file.
static mw::E<Configuration> fromYaml(
const std::filesystem::path& path);
};