#pragma once

#include "arrowelement.h"
#include "classicmode/classicnote.h"

#include "classicmode/arrownoteinitializer.h"

class HoldManager;

class ClassicArrowNote : public ClassicNote
{
public:
    enum class Grade
    {
        PERFECT,
           GOOD,
            BAD
    };

    explicit ClassicArrowNote(ArrowNoteInitializer&& init, const std::shared_ptr<HoldManager>& hold_manager);
    virtual ~ClassicArrowNote() = default;

    virtual bool isActive(const kku::microsec& offset) const override;
    virtual void update(const kku::microsec &music_offset) override;
    virtual void input(kku::GameEvent&& input) override;

    bool allElementsPressed() const;
    bool isPressedAs(kku::SystemEvent::Key::Code key) const;
    inline bool isHold() const;

    std::vector<ArrowElement>& getElements();

private:
    const kku::PrecisionEvaluator<Grade> _evaluator;
    const std::shared_ptr<HoldManager> _hold_manager;

    std::vector<ArrowElement> _elements;
    bool _is_hold;
};

using ArrowElements = std::vector<ArrowElement>;
