using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace Assets.Scripts.Events
{
    public abstract class EventBuilder
    {
        private readonly Act _act;
        private EventFactory _factory;

        protected EventBuilder(Act act) {
            _act = act;
        }

        public void Run(EventFactory factory) {
            _factory = factory;
            factory.StartActSetup(_act);
            AddEvents();
        }

        protected abstract void AddEvents();

        protected GameEvent AddEvent(GameEvent.Node node) {
            var e = new GameEvent(node);
            _factory.AddEvent(e);
            return e;
        }

        protected GameEvent AddRecurringEvent (GameEvent.Node node) {
            var e = new GameEvent(node) {Recurring = true};
            _factory.AddEvent(e);
            return e;
        }

        protected GameEvent AddSpecificEvent (string name, GameEvent.Node node) {
            var e = new GameEvent(node);
            _factory.AddSpecificEvent(e, name);
            return e;
        }
    }
}
