#ifndef DIRECTORIES_HPP
#define DIRECTORIES_HPP

#include <string>

namespace dropshell {

    // all functions return empty string on failure

    //------------------------------------------------------------------------------------------------
    // local user config directories
    // config_path
    //   |-- servers
    //   |   |-- server_name
    //   |       |-- server.env
    //   |       |-- services
    //   |           |-- service_name
    //   |               |-- service.env
    //   |               |-- (other config files for specific server&service)
    //   |-- templates
    //   |   |-- template_name
    //   |       |-- (script files)
    //   |       |-- example
    //   |           |-- service.env
    //   |           |-- (other service config files)
    //   |-- .remote_versions
    //   |   |-- server_name
    //   |       |-- service_name.hash.env
    namespace localfile {
        // ~/.config/dropshell/dropshell.conf
        std::string dropshell_env();
        std::string server_env(const std::string &server_name);
        std::string service_env(const std::string &server_name, const std::string &service_name);
        std::string service_hash(const std::string &server_name, const std::string &service_name);
    } // namespace localfile

    namespace localpath {
        // /opt/dropshell/templates
        std::string system_templates();

        // configured by user - defaults to first config_path/backups.
        std::string backups_path();

        int num_config_directories();
        std::string config(int index=0);
        std::string config_templates(int index=0);
        std::string config_servers(int index=0);

        std::string server(const std::string &server_name);
        std::string service(const std::string &server_name, const std::string &service_name);
    } // namespace local


    //------------------------------------------------------------------------------------------------
    // remote paths
    // DROPSHELL_DIR
    //   |-- backups
    //   |-- services
    //       |-- service name
    //           |-- config
    //               |-- service.env
    //           |-- template
    //               |-- (script files)
    //               |-- example
    //                   |-- service.env
    //                   |-- (other config files for specific server&service)

    namespace remotefile {
        std::string service_env(const std::string &server_name, const std::string &service_name);
    } // namespace remotefile

    namespace remotepath {
        std::string DROPSHELL_DIR(const std::string &server_name);
        std::string services(const std::string &server_name);
        std::string service(const std::string &server_name, const std::string &service_name);
        std::string service_config(const std::string &server_name, const std::string &service_name);
        std::string service_template(const std::string &server_name, const std::string &service_name);
        std::string backups(const std::string &server_name);
    } // namespace remotepath

    //------------------------------------------------------------------------------------------------
    // utility functions
    std::string get_parent(std::string path);

} // namespace dropshell

#endif
