#pragma once

#include "Universe.hpp"
#include "../../core/server_handle.hpp"

namespace world::server {
    class SharedArea;

    /// Server with data for LocalClientUniverse binding
    class SharedUniverse final: public Universe {
    public:
        SharedUniverse(const options &, server_handle *const);
        virtual ~SharedUniverse();

    protected:
        std::shared_ptr<Chunk> createChunk(const chunk_pos &pos, const std::unique_ptr<generator::Abstract> &rnd) const override;
        std::shared_ptr<Chunk> createChunk(std::istream &str) const override;
        std::shared_ptr<Chunk> createChunk() const override;

        void loadChunk(area_<chunk_pos>, chunk_pos, const world::ChunkContainer &) override;
        void updateChunk(area_map::iterator &, world::ChunkContainer::iterator &, chunk_pos, float deltaTime) override;

        void broadcastMessage(const std::string&) override;
        void broadcastEntities() override;

    private:
        server_handle *const localHandle;
    };
}