import { jsx as _jsx } from "react/jsx-runtime";
/**
 * Build the action list for the (+) FloatingActionButton on the control
 * center. Extracted from control-center-inner.tsx so the parent component
 * stays focused on graph state + rendering.
 */
import { useMemo } from 'react';
import { ClipboardList, FolderOpen, FolderPlus, GitBranch, Github, LayoutGrid, Sparkles, } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { BuildMode } from '../../../../../../packages/core/src/domain/generated/output.js';
import { buildCreateUrl } from '../../../lib/url-params.js';
export function useFabActions({ router, clickSound, guardedNavigate, handlePickFolder, onNewProject, onNewApplication, selectedApplicationId, selectedApplicationName, }) {
    const { t } = useTranslation('web');
    return useMemo(() => {
        const actions = [
            {
                id: 'new-project',
                label: 'New project',
                icon: _jsx(FolderPlus, { className: "h-4 w-4" }),
                onClick: () => {
                    clickSound.play();
                    onNewProject();
                },
            },
            {
                id: 'new-feature',
                label: t('fab.newFeature'),
                icon: _jsx(Sparkles, { className: "h-4 w-4" }),
                onClick: () => {
                    clickSound.play();
                    guardedNavigate(() => router.push('/create'));
                },
            },
            {
                id: 'add-local-repo',
                label: t('fab.localFolder'),
                icon: _jsx(FolderOpen, { className: "h-4 w-4" }),
                onClick: handlePickFolder,
            },
            {
                id: 'new-application',
                label: t('fab.newApplication'),
                icon: _jsx(LayoutGrid, { className: "h-4 w-4" }),
                onClick: onNewApplication,
            },
        ];
        if (selectedApplicationId) {
            actions.push({
                id: 'new-sdd-feature-for-app',
                label: t('fab.newSddForApp', { appName: selectedApplicationName ?? '' }),
                icon: _jsx(ClipboardList, { className: "h-4 w-4" }),
                onClick: () => {
                    clickSound.play();
                    guardedNavigate(() => router.push(buildCreateUrl({
                        applicationId: selectedApplicationId,
                        mode: BuildMode.Spec,
                    })));
                },
            });
        }
        actions.push({
            id: 'adopt-branch',
            label: t('fab.adoptBranch'),
            icon: _jsx(GitBranch, { className: "h-4 w-4" }),
            onClick: () => {
                guardedNavigate(() => router.push('/adopt'));
            },
        });
        actions.push({
            id: 'add-github-repo',
            label: t('fab.fromGithub'),
            icon: _jsx(Github, { className: "h-4 w-4" }),
            onClick: () => {
                window.dispatchEvent(new CustomEvent('shep:open-github-import'));
            },
        });
        return actions;
    }, [
        t,
        clickSound,
        guardedNavigate,
        router,
        handlePickFolder,
        onNewProject,
        onNewApplication,
        selectedApplicationId,
        selectedApplicationName,
    ]);
}
