import abc
import asyncio
from utils.value import AttributeChange


class ATask(AttributeChange):
	def __init__(self, interval):
		AttributeChange.__init__(self)
		self.interval = interval

	@abc.abstractmethod
	def on_process(self):
		pass


class TaskManager:
	def __init__(self):
		self.tasks = []

	def add(self, task: ATask):
		self.tasks.append(task)

	def start(self):
		funcs = []
		for task in self.tasks:
			funcs.append(task.on_process())

		return asyncio.gather(*funcs)
