import React, { useState } from 'react';
import { Button } from 'antd';
import styles from './EmergencyResource.less';
import EventWarningManagement from './components/EventWarningManagement';
import EventNotification from './components/EventNotification';

const EmergencyAccident = () => {
    const [activeModule, setActiveModule] = useState('warning');

    const handleModuleClick = (module) => {
        setActiveModule(module);
    };

    const renderModule = () => {
        switch (activeModule) {
            case 'warning':
                return <EventWarningManagement />;
            case 'notification':
                return <EventNotification />;
            default:
                return <EventWarningManagement />;
        }
    };

    return (
        <div className={styles.container}>
            <div className={styles.TopButton}>
                <Button
                    className={`${styles.TopButtonItem} ${activeModule === "warning" ? styles.active : ""}`}
                    onClick={() => handleModuleClick("warning")}
                >
                    事件预警管理
                </Button>
                <Button 
                    className={`${styles.TopButtonItem} ${activeModule === "notification" ? styles.active : ""}`}
                    onClick={() => handleModuleClick("notification")}
                >
                    事件通知
                </Button>
            </div>
            <div className={styles.content}>
                {renderModule()}
            </div>
        </div>
    );
};

export default EmergencyAccident;
