"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.generator = exports.generatorId = void 0;
const Generator = __importStar(require("@postxl/generator"));
const backend_router_trpc_1 = require("../backend-router-trpc");
const base_1 = require("../base");
const frontend_core_1 = require("../frontend-core");
const frontend_trpc_client_1 = require("../frontend-trpc-client");
const ai_action_text_utils_generator_1 = require("./generators/ai-action-text.utils.generator");
const ai_assistant_store_generator_1 = require("./generators/ai-assistant-store.generator");
const ai_sidebar_content_generator_1 = require("./generators/ai-sidebar-content.generator");
const ai_sidepane_generator_1 = require("./generators/ai-sidepane.generator");
const base_global_actions_generator_1 = require("./generators/base-global-actions.generator");
const command_palette_generator_1 = require("./generators/command-palette.generator");
const command_palette_action_generator_1 = require("./generators/command-palette-action.generator");
const command_palette_store_generator_1 = require("./generators/command-palette-store.generator");
const filter_utils_generator_1 = require("./generators/filter-utils.generator");
const sidepanel_toggle_generator_1 = require("./generators/sidepanel-toggle.generator");
exports.generatorId = Generator.toGeneratorInterfaceId('frontend-actions');
exports.generator = {
    id: exports.generatorId,
    requires: [base_1.baseGeneratorId, frontend_core_1.frontendGeneratorId, backend_router_trpc_1.backendTrpcRouterGeneratorId, frontend_trpc_client_1.frontendTrpcClientGeneratorId],
    register: (context) => {
        const commandPalette = {
            name: Generator.toFunctionName('CommandPalette'),
            location: Generator.toBackendModuleLocation('@app-actions/command-palette'),
        };
        const baseGlobalActions = {
            name: Generator.toFunctionName('useBaseGlobalActions'),
            location: Generator.toBackendModuleLocation('@app-actions/base-global.actions'),
        };
        return {
            ...context,
            frontendActions: {
                commandPalette,
                globalActionHooks: [baseGlobalActions],
            },
        };
    },
    generate: (context) => {
        context.vfs.write('frontend/src/actions/command-palette-action.ts', (0, command_palette_action_generator_1.generateCommandPaletteAction)());
        context.vfs.write('frontend/src/actions/command-palette-store.ts', (0, command_palette_store_generator_1.generateCommandPaletteStore)());
        context.vfs.write('frontend/src/actions/ai-assistant-store.ts', (0, ai_assistant_store_generator_1.generateAiAssistantStore)());
        context.vfs.write('frontend/src/actions/ai-action-text.utils.ts', (0, ai_action_text_utils_generator_1.generateAiActionTextUtils)());
        context.vfs.write('frontend/src/actions/ai-sidebar-content.tsx', (0, ai_sidebar_content_generator_1.generateAiSidebarContent)());
        context.vfs.write('frontend/src/actions/ai-sidepane.tsx', (0, ai_sidepane_generator_1.generateAiSidepane)());
        context.vfs.write('frontend/src/actions/sidepanel-toggle.tsx', (0, sidepanel_toggle_generator_1.generateSidepanelToggle)());
        context.vfs.write('frontend/src/actions/base-global.actions.tsx', (0, base_global_actions_generator_1.generateBaseGlobalActions)());
        context.vfs.write('frontend/src/actions/command-palette.tsx', (0, command_palette_generator_1.generateCommandPalette)({ context }));
        context.vfs.write('frontend/src/lib/command-palette-filter.utils.ts', (0, filter_utils_generator_1.generateFilterUtils)());
        const rootDocumentPath = 'frontend/src/pages/root-document.tsx';
        const rootDocument = context.vfs.get(rootDocumentPath);
        if (typeof rootDocument === 'string') {
            context.vfs.write(rootDocumentPath, rootDocument);
        }
        return context;
    },
};
//# sourceMappingURL=actions.generator.js.map