"""To geneate a Sitemap with all events."""
from kasu.sitemaps import GenericSitemap
from django.utils import timezone
from django.urls import reverse
from events.models import Event



class MaistarGamesSitemap(GenericSitemap):
    @staticmethod
    def items():
        """add all upcoming and archived events to the sitemap."""
        return Event.objects.all().exclude(maistargame_set=None)

    @staticmethod
    def location(event):
        return reverse('maistar-game-list', kwargs={'event': event.id})
