#ifndef FLAT_WORLD_TYPE_HPP_
#define FLAT_WORLD_TYPE_HPP_

#include <WorldType/WorldType.hpp>
#include <WorldGenerator/FlatWorldGenerator/FlatWorldGenerator.hpp>

/**
 * @brief The flat world type.
 */
class FlatWorldType : public WorldType
{
private:
    class Settings : public WorldTypeSettings
    {
    public:
        std::vector<FlatWorldGenerator::LayerSpec> layers;
        std::string bottomBlock;

        virtual void serialize(std::vector<uint8_t> &output) override;
        virtual std::unique_ptr<WorldGenerator> makeWorldGenerator(LocalWorld &world) override;

        static std::shared_ptr<Settings> deserialize(const uint8_t *data, size_t size);
    };

    class CreationForm : public WorldTypeCreationForm
    {
    private:
        enum class Theme
        {
            Grasslands,
            Desert,
            RockSolid,
            Marble,
            Basalt,
        } selectedTheme = Theme::Grasslands;

    public:
        CreationForm(std::function<void()> onAccept);

        virtual std::shared_ptr<WorldTypeSettings> makeSettings() override;
        virtual bool isAcceptable() override;
    };

public:
    virtual std::string_view getName() override;
    virtual WorldTypeCreationForm* makeCreationForm(std::function<void()> onAccept) override;
    virtual std::shared_ptr<WorldTypeSettings> deserializeSettings(const uint8_t *data, size_t size) override;
    virtual std::shared_ptr<WorldTypeSettings> parseSettingsFromCmdArgs(const std::string *args, size_t numArgs) override;
};

#endif