'use client';

import { useState } from "react";
import StatistikMahasiswaChart from "@/components/StatistikMahasiswaChart";
import StatistikPerAngkatanChart from "@/components/StatistikPerAngkatanChart";
import JenisPendaftaranChart from "@/components/JenisPendaftaranChart";
import AsalDaerahChart from "@/components/AsalDaerahChart";
import IPKChart from "@/components/IPKChart";
import FilterTahunAngkatan from "@/components/FilterTahunAngkatan";
import JenisPendaftaranPerAngkatanChart from "@/components/JenisPendaftaranPerAngkatanChart";
import AsalDaerahPerAngkatanChart from "@/components/AsalDaerahPerAngkatanChart";
import IPKJenisKelaminChart from "@/components/IPKJenisKelaminChart";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";

export default function TotalMahasiswaPage() {
  const [selectedYear, setSelectedYear] = useState<string>("all");

  return (
    <div className="container mx-auto p-4 space-y-6">
      <h1 className="text-3xl font-bold mb-4">Total Mahasiswa</h1>
      
      <div className="mb-4">
        <p className="text-gray-600 dark:text-gray-300">
          Mahasiswa total adalah jumlah mahasiswa program studi Informatika Fakultas Teknik Universitas Tanjungpura.
        </p>
      </div>

      <Card className="bg-white dark:bg-slate-900 shadow-lg dark:text-white">
          <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
            <CardTitle className="text-sm font-medium dark:text-white">
              Filter Data
            </CardTitle>
          </CardHeader>
          <CardContent>
            <div className="flex flex-col sm:flex-row items-start sm:items-center gap-4 sm:space-x-4">
              <FilterTahunAngkatan 
                selectedYear={selectedYear}
                onYearChange={setSelectedYear}
              />
            </div>
          </CardContent>
        </Card>

      {selectedYear === "all" ? (
        <>
          <StatistikMahasiswaChart />
          <JenisPendaftaranChart />
          <AsalDaerahChart />
          <IPKChart />
        </>
      ) : (
        <>
          <StatistikPerAngkatanChart tahunAngkatan={selectedYear} />
          <JenisPendaftaranPerAngkatanChart tahunAngkatan={selectedYear} />
          <AsalDaerahPerAngkatanChart tahunAngkatan={selectedYear} />
        </>
      )}
    </div>
  );
}
