import { useState, useEffect } from 'react';
import PageMeta from '../../components/common/PageMeta';
import { useToast } from '../../components/ui/toast/ToastContainer';
import { fetchAPI } from '../../services/api';
import { Card } from '../../components/ui/card';

export default function ModuleSettings() {
  const toast = useToast();
  const [settings, setSettings] = useState<any[]>([]);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    loadSettings();
  }, []);

  const loadSettings = async () => {
    try {
      setLoading(true);
      const response = await fetchAPI('/v1/system/settings/modules/');
      setSettings(response.results || []);
    } catch (error: any) {
      toast.error(`Failed to load module settings: ${error.message}`);
    } finally {
      setLoading(false);
    }
  };

  return (
    <div className="p-6">
      <PageMeta title="Module Settings" />
      <div className="mb-6">
        <h1 className="text-2xl font-bold text-gray-900 dark:text-white">Module Settings</h1>
        <p className="text-gray-600 dark:text-gray-400 mt-1">Module-specific configuration</p>
      </div>

      {loading ? (
        <div className="flex items-center justify-center h-64">
          <div className="text-gray-500">Loading...</div>
        </div>
      ) : (
        <Card className="p-6">
          <p className="text-gray-600 dark:text-gray-400">Module settings management interface coming soon.</p>
        </Card>
      )}
    </div>
  );
}

