/**
 * Copyright 2021 Johannes Marbach
 *
 * This file is part of lvglcharger, hereafter referred to as the program.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 */


#ifndef UL_CONFIG_H
#define UL_CONFIG_H

#include "backends.h"
#include "themes.h"

#include <stdbool.h>
#include <stdint.h>

/**
 * General options
 */
typedef struct {
    /* Backend to use */
    ul_backends_backend_id_t backend;
    /* If true, use animations */
    bool animations;
    /* Timeout (in seconds) - once elapsed, the device will shutdown. 0 (default) to disable */
    uint16_t timeout;
} ul_config_opts_general;

/**
 * Options related to the theme
 */
typedef struct {
    /* Default theme */
    ul_themes_theme_id_t default_id;
    /* Alternate theme */
    ul_themes_theme_id_t alternate_id;
} ul_config_opts_theme;

/**
 * Options parsed from config file(s)
 */
typedef struct {
    /* General options */
    ul_config_opts_general general;
    /* Options related to the theme */
    ul_config_opts_theme theme;
} ul_config_opts;

/**
 * Parse options from one or more configuration files.
 * 
 * @param files paths to configuration files
 * @param num_files number of configuration files
 * @param opts pointer for writing the parsed options into
 */
void ul_config_parse(const char **files, int num_files, ul_config_opts *opts);

#endif /* UL_CONFIG_H */
