#pragma once

#include <memory>

#include "core/editor.h"
#include "core/timeline.h"
#include "selectionmanager.h"

#include "classicmocknote.h"
#include "classicmode/classicactions.h"

class ClassicGraphicsManager;

class ClassicEditor : public kku::Editor
{
public:
    explicit ClassicEditor(const std::shared_ptr<kku::Timeline<ClassicMockNote>>& timeline,
                           const std::shared_ptr<ClassicGraphicsManager>& graphics_manager,
                           const std::shared_ptr<SelectionManager<ClassicMockNote>>& selection_manager);

    virtual void input(kku::GameEvent&& input) override;
    virtual void update(kku::UpdateData&& updatedata) override;
    virtual void display() const override;
    virtual void recalculate(const kku::microsec& timestamp) override;

    void selectNoteType(Type type) noexcept;

private:
    inline kku::microsec adjustOffset(kku::microsec offset) const noexcept;

    const std::shared_ptr<kku::Timeline<ClassicMockNote>> _timeline;
    const std::shared_ptr<ClassicGraphicsManager> _graphics_manager;
    const std::shared_ptr<SelectionManager<ClassicMockNote>> _selection_manager;

    Type _selected_type;
    kku::microsec _current_time;
    kku::microsec _scroll_step;
};
