import os
import platform

from django import get_version as django_version
from django.shortcuts import render
from django.utils import timezone


def index(request):
    """Render the SIEM dashboard with mock data."""
    context = {
        "project_name": "SIEM Dashboard",
        "security_score": 78,
        "alerts": [
            {
                "id": 1,
                "title": "Multiple failed login attempts",
                "severity": "critical",
                "timestamp": "2025-12-15 10:30:00",
                "source": "auth.log"
            },
            {
                "id": 2,
                "title": "Potential SQL Injection attempt",
                "severity": "high",
                "timestamp": "2025-12-15 10:25:00",
                "source": "suricata.log"
            },
            {
                "id": 3,
                "title": "Unusual process execution",
                "severity": "medium",
                "timestamp": "2025-12-15 10:15:00",
                "source": "syslog"
            },
            {
                "id": 4,
                "title": "Access from a known malicious IP",
                "severity": "high",
                "timestamp": "2025-12-15 10:10:00",
                "source": "suricata.log"
            }
        ],
        "project_description": os.getenv("PROJECT_DESCRIPTION", "A SIEM tool for log analysis."),
        "project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
    }
    return render(request, "core/index.html", context)
