from django.contrib import sitemaps
from django.urls import reverse

# --- FEATURES ---
from courses.models import Course
from users.models import Profile
from blog.models import Post

# --- SITEMAP : LES Cours ---
class CourseSitemap(sitemaps.Sitemap):
    changefreq = "weekly"
    priority = 0.9

    def items(self):
        return Course.objects.filter(enable=True) # Exemple de filtre

    def location(self, item):
        # Assure-toi que ton modèle Course a bien une méthode get_absolute_url
        return item.get_absolute_url()

# --- SITEMAP : BLOG ---
class BlogSitemap(sitemaps.Sitemap):
    changefreq = "weekly"
    priority = 0.8

    def location(self, item):
        return item.get_absolute_url()

# --- SITEMAP : PAGES STATIQUES ---
class StaticViewSitemap(sitemaps.Sitemap):
    priority = 0.5
    changefreq = "monthly"

    def items(self):
        return ["home"] # Les noms de tes URLs

    def location(self, item):
        return ""