#ifndef SURVIVAL_WORLD_TYPE_HPP_
#define SURVIVAL_WORLD_TYPE_HPP_

#include <WorldType/WorldType.hpp>

/**
 * @brief The survival world type.
 */
class SurvivalWorldType : public WorldType
{
private:
    class Settings : public WorldTypeSettings
    {
    public:
        uint64_t seed;

        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:
        std::string seedString;

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

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

public:
    /**
     * @brief Create settings for a survival world with the given seed.
     * 
     * @param seed The seed, or `std::nullopt` (the default) to automatically generate.
     * @return The settings pointer.
     */
    static std::shared_ptr<WorldTypeSettings> createSettingsWithSeed(std::optional<uint64_t> seed = std::nullopt);

    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