/*
 * @brief Defines the communication file format
 * @file aman/config/CommunicationFileFormat.h
 * @author Sven Czarnian <devel@svcz.de>
 * @copyright Copyright 2021 Sven Czarnian
 * @license This project is published under the GNU General Public License v3 (GPLv3)
 */

#pragma once

#include <aman/config/FileFormat.h>
#include <aman/types/Communication.h>

namespace aman {
    /**
     * @brief Defines the parser of communication configurations
     * @ingroup format
     *
     * All configuration entries need to be stored in 'AmanCommunication.txt'.
     *
     * The following entries of the configuration exist:
     * <table>
     *   <caption id="multi_row">Setting entries</caption>
     *   <tr>
     *     <th>Name</th><th>Description</th><th>Default value</th><th>Unit</th>
     *   </tr>
     *   <tr>
     *     <td>URL</td>
     *     <td>Defines the URL to the backend.</td>
     *     <td></td><td></td>
     *   </tr>
     *   <tr>
     *     <td>Port</td>
     *     <td>Defines the port to access the backend.</td>
     *     <td></td><td></td>
     *   </tr>
     *   <tr>
     *     <td>UID</td>
     *     <td>Defines the identifier to access the backend.</td>
     *     <td></td><td></td>
     *   </tr>
     * </table>
     */
    class CommunicationFileFormat : public FileFormat {
#ifndef DOXYGEN_IGNORE
    public:
        /**
         * @brief Initializes the communication file format
         */
        CommunicationFileFormat();

        /**
         * @brief Parses the set configuration file
         * @param[in] filename The path to the configuration file
         * @param[out] config The resulting configuration
         * @return True if the configuration file was valid, else false
         */
        bool parse(const std::string& filename, Communication& config);
#endif
    };
}
