using System;
using Intrepid.SimpleEvents;

namespace Intrepid.Gameplay.Codex.UI.Controllers
{
    public readonly struct CodexSubscriber
    {
        private EventBus EventBus { get; }
        private string SubscriptionId { get; }

        public CodexSubscriber(EventBus eventBus, string subscriptionId)
        {
            EventBus = eventBus;
            SubscriptionId = subscriptionId;
        }

        public void Subscribe<T>(Action<T> action) where T: IEventBase
        {
            EventBus.Subscribe(SubscriptionId, action);
        }
    }
}