import React, { useState } from 'react';
import { Select } from 'antd';
import styles from './OilDataManagement.less';
import BasicInfo from './second_oil_components/BasicInfo';
import PhysChem from './second_oil_components/PhysChem';
import SafetyReasonable from './second_oil_components/SafetyReasonable';
import BusinessAttributeInfo from './second_oil_components/BusinessAttributeInfo';
import AuditDiary from './second_oil_components/AuditDiary';

const OilDataManagement = () => {
    // 顶部一行选择：第一个为“基本信息/理化性质”，其余占位
    const [firstMenu, setFirstMenu] = useState('basic');
    const [secondMenu, setSecondMenu] = useState(undefined);
    const [thirdMenu, setThirdMenu] = useState(undefined);
    const [fourthMenu, setFourthMenu] = useState(undefined);
    const [fifthMenu, setFifthMenu] = useState(undefined);

    const firstMenuLabelMap = {
        basic: '基本信息',
        physchem: '理化性质',
        safety: '安全与合理',
        business: '业务属性',
        audit: '审计日记',
    };

    const renderFirstMenuContent = () => {
        switch (firstMenu) {
            case 'basic':
                return <BasicInfo />;
            case 'physchem':
                return <PhysChem />;
            case 'safety':
                return <SafetyReasonable />;
            case 'business':
                return <BusinessAttributeInfo />;
            case 'audit':
                return <AuditDiary />;
            default:
                return null;
        }
    };

    return (
        <div className={styles.container}>
            <div className={styles.topBar}>
                <div
                    className={styles.currentLabel}
                >
                    当前：{firstMenuLabelMap[firstMenu] || '未选择'}
                </div>
                <div className={styles.selectsWrapper}>
                    <Select
                        className={styles.topSelect}
                        value={firstMenu}
                        onChange={setFirstMenu}
                        options={[
                            { label: '基本信息', value: 'basic' },
                            { label: '理化性质', value: 'physchem' },
                            { label: '安全与合理', value: 'safety' },
                            { label: '业务属性', value: 'business' },
                            { label: '审计日记', value: 'audit' },
                        ]}
                    />
                    <Select
                        className={styles.topSelect}
                        value={secondMenu}
                        onChange={setSecondMenu}
                        placeholder="安全与合规"
                        options={[]}
                        disabled
                    />
                    <Select
                        className={styles.topSelect}
                        value={thirdMenu}
                        onChange={setThirdMenu}
                        placeholder="业务属性"
                        options={[]}
                        disabled
                    />
                    <Select
                        className={styles.topSelect}
                        value={fourthMenu}
                        onChange={setFourthMenu}
                        placeholder="文档资料"
                        options={[]}
                        disabled
                    />
                    <Select
                        className={styles.topSelect}
                        value={fifthMenu}
                        onChange={setFifthMenu}
                        placeholder="审计日志"
                        options={[]}
                        disabled
                    />
                </div>
            </div>

            {renderFirstMenuContent()}
        </div>
    );
};

export default OilDataManagement;

