/**
Copyright (C) 2024  Matthew Kosarek

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 <http://www.gnu.org/licenses/>.
**/

#ifndef MIRACLE_WM_STUB_CONFIGURATION_H
#define MIRACLE_WM_STUB_CONFIGURATION_H

#include "config.h"

namespace miracle
{
namespace test
{
    class StubConfiguration : public miracle::Config
    {
    public:
        void load(mir::Server& server) override { }
        void reload() override { }
        [[nodiscard]] std::string const& get_filename() const override { return filename; }
        [[nodiscard]] MirInputEventModifier get_input_event_modifier() const override { return mir_input_event_modifier_none; }
        [[nodiscard]] CustomKeyCommand const* matches_custom_key_command(MirKeyboardAction action, int scan_code, unsigned int modifiers) const override
        {
            return nullptr;
        }

        bool matches_key_command(MirKeyboardAction action, int scan_code, unsigned int modifiers, std::function<bool(DefaultKeyCommand)> const& f) const override
        {
            return false;
        }

        [[nodiscard]] int get_inner_gaps_x() const override
        {
            return 0;
        }

        [[nodiscard]] int get_inner_gaps_y() const override
        {
            return 0;
        }

        [[nodiscard]] int get_outer_gaps_x() const override
        {
            return 0;
        }

        [[nodiscard]] int get_outer_gaps_y() const override
        {
            return 0;
        }

        [[nodiscard]] std::vector<StartupApp> const& get_startup_apps() const override
        {
            return startup_apps;
        }

        [[nodiscard]] std::optional<std::string> const& get_terminal_command() const override
        {
            return terminal_command;
        }

        [[nodiscard]] int get_resize_jump() const override
        {
            return 0;
        }

        [[nodiscard]] std::vector<EnvironmentVariable> const& get_env_variables() const override
        {
            return env;
        }

        [[nodiscard]] BorderConfig const& get_border_config() const override
        {
            return border_config;
        }

        [[nodiscard]] std::array<AnimationDefinition, (int)AnimateableEvent::max> const& get_animation_definitions() const override
        {
            return animations;
        }

        [[nodiscard]] bool are_animations_enabled() const override
        {
            return false;
        }

        [[nodiscard]] WorkspaceConfig get_workspace_config(std::optional<int> const& num, std::optional<std::string> const& name) const override
        {
            return { num, ContainerType::leaf, name };
        }

        int register_listener(std::function<void(miracle::Config&)> const&) override
        {
            return -1;
        }

        /// Register a listener on configuration change. A lower "priority" number signifies that the
        /// listener should be triggered earlier. A higher priority means later
        int register_listener(std::function<void(miracle::Config&)> const&, int priority) override
        {
            return -1;
        }

        void unregister_listener(int handle) override
        {
        }

        void try_process_change() override { }

        [[nodiscard]] uint get_primary_modifier() const override
        {
            return 0;
        }

        [[nodiscard]] LayoutScheme get_default_layout_scheme() const override
        {
            return LayoutScheme::horizontal;
        }

        [[nodiscard]] DragAndDropConfiguration drag_and_drop() const override
        {
            return {};
        }

        [[nodiscard]] uint move_modifier() const override
        {
            return 0;
        }

        [[nodiscard]] uint get_primary_button() const override
        {
            return mir_pointer_button_primary;
        }

    private:
        miracle::BorderConfig border_config;
        std::array<AnimationDefinition, static_cast<int>(AnimateableEvent::max)> animations;
        std::string filename;
        std::vector<StartupApp> startup_apps;
        std::optional<std::string> terminal_command;
        std::vector<EnvironmentVariable> env;
    };
}
}

#endif // MIRACLE_WM_STUB_CONFIGURATION_H
