import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { Database, Server, Settings } from "lucide-react";

import AddCredits from "@/components/dashboard/add-credits";
import AddCreditsSingleUser from "@/components/dashboard/add-credits-single-user";
import UserManagement from "@/components/dashboard/user-management";

export default function SettingsPage() {
  return (
    <div className="space-y-6">
      <div>
        <h1 className="text-3xl font-bold tracking-tight">Paramètres</h1>
        <p className="text-muted-foreground">
          Configuration et maintenance du système
        </p>
      </div>

      {/* Informations système */}
      <div className="grid gap-6 md:grid-cols-2">
        <Card>
          <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
            <CardTitle className="text-sm font-medium flex items-center gap-2">
              <Database className="h-4 w-4" />
              Base de données
            </CardTitle>
          </CardHeader>
          <CardContent>
            <div className="space-y-2">
              <div className="flex justify-between">
                <span className="text-sm text-muted-foreground">
                  Statut MongoDB
                </span>
                <Badge variant="default">Connecté</Badge>
              </div>
            </div>
          </CardContent>
        </Card>

        <Card>
          <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
            <CardTitle className="text-sm font-medium flex items-center gap-2">
              <Server className="h-4 w-4" />
              Informations système
            </CardTitle>
          </CardHeader>
          <CardContent>
            <div className="space-y-2">
              <div className="flex justify-between">
                <span className="text-sm text-muted-foreground">
                  Version Next.js
                </span>
                <Badge variant="outline">15.0.3</Badge>
              </div>
              <div className="flex justify-between">
                <span className="text-sm text-muted-foreground">
                  Version Node.js
                </span>
                <Badge variant="outline">{process.version}</Badge>
              </div>
              <div className="flex justify-between">
                <span className="text-sm text-muted-foreground">
                  Environnement
                </span>
                <Badge variant="outline">Development</Badge>
              </div>
            </div>
          </CardContent>
        </Card>
      </div>

      {/* Gestion des utilisateurs */}
      <UserManagement />

      {/* Gestion des crédits */}
      <Card>
        <CardHeader>
          <CardTitle className="flex items-center gap-2">
            <Settings className="h-6 w-6" />
            Gestion des Crédits
          </CardTitle>
        </CardHeader>
        <CardContent className="space-y-6">
          <AddCreditsSingleUser />
          <div className="border-t pt-6">
            <AddCredits />
          </div>
        </CardContent>
      </Card>
    </div>
  );
}
