<?php

require_once __DIR__ . '/../../src/Classes/Tribe.php';

abstract class Event
{
    protected $tribe;
    protected $story = '';
    protected $participants = []; // array of kobold ids
    protected $reportedDeaths = [];

    public function isEndOfMonth()
    {
        return false;
    }

    public function __construct(Tribe $tribe)
    {
        $this->tribe = $tribe;
    }

    abstract public function execute();

    abstract public function getCost();

    public function isAvailable()
    {
        return true;
    }

    public function setParticipants(array $koboldIds)
    {
        $this->participants = $koboldIds;
    }

    public function getParticipants()
    {
        return $this->participants;
    }

    abstract function getMinParticipants();

    abstract function getMaxParticipants();

    abstract function getMinAge();

    public function getStory()
    {
        return $this->story;
    }

    public function getReportedDeaths(): array
    {
        return array_keys($this->reportedDeaths);
    }

    protected function reportDeath($kobold)
    {
        if ($kobold && method_exists($kobold, 'getId')) {
            $this->reportedDeaths[$kobold->getId()] = true;
        }
    }
}
