#pragma once
#include "Repository.h"
#include "Song.h"


class Action
{
    public:
        virtual ~Action() = default;
        virtual void executeUndo() = 0;
        virtual void executeRedo() = 0;
};

class AddAction : public Action
{
    private:
        Repository& repo;
        Song addedSong;
    public:
        AddAction(Repository& repo, const Song& addedSong) : repo{ repo }, addedSong{ addedSong } {}
        void executeUndo() override
        {
            this->repo.removeSong(addedSong);
        }
        void executeRedo() override
        {
            this->repo.addSong(addedSong);
        }

};

class RemoveAction : public Action
{
    private:
        Repository& repo;
        Song removedSong;
    public:
        RemoveAction(Repository& repo, const Song& removedSong) : repo{ repo }, removedSong{ removedSong } {}
        void executeUndo() override
        {
            this->repo.addSong(removedSong);
        }
        void executeRedo() override
        {
            this->repo.removeSong(removedSong);
        }

};

// class UpdateAction : public Action
// {
//     private:
//         Repository& repo;
//         Song updatedSong;
//         Song oldSong;
//     public:
//         UpdateAction(Repository& repo, const Song& updatedSong, const Song& oldSong) : repo{ repo }, updatedSong{ updatedSong }, oldSong{ oldSong } {}
//         void executeUndo() override
//         {
//             this->repo.updateSong(updatedSong, oldSong);
//         }
//         void executeRedo() override
//         {
//             this->repo.updateSong(oldSong, updatedSong);
//         }

// };