import type { ButtonConfig } from '../../../../index.type';
import type { BimEngine } from '../../../../../../bim-engine';

/**
 * 剖切盒按钮配置
 */
export const createSectionBoxButton = (engine: BimEngine): ButtonConfig => {
    return {
        id: 'section-box',
        groupId: 'group-1',
        parentId: 'section',
        type: 'button',
        keepActive: true,
        exclusive: true,
        align: 'vertical',
        label: 'toolbar.sectionBox',
        icon: '<svg width="32" height="32" viewBox="0 0 24 24"><circle cx="12" cy="12" r="6" fill="currentColor"/></svg>',
        onClick: (button) => {
            console.log('剖切盒被点击:', button.id, '激活状态:', button.isActive);
            if (button.isActive) {
                // 激活时显示弹窗
                engine.sectionBox?.show();
            } else {
                // 关闭时隐藏弹窗
                engine.sectionBox?.hide();
            }
        }
    };
};
