﻿using System;
using MenuSystem.Abstract;

namespace MenuSystem.MenuItems
{
    public class MenuButton : IMenuItem
    {
        public string Description { get; private set; }

        public Action EventCallback;

        public MenuButton(string desc, Action eventCallback)
        {
            Description = desc;
            EventCallback += eventCallback;
        }

        public string RenderItem()
        {
            return Description;
        }

        public void HandleAdditionalInput(ConsoleKeyInfo key)
        {
            if (key.Key == ConsoleKey.Spacebar)
                EventCallback();
        }
    }
}