"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isToolSetupPreviewDeployResult = exports.toolSetupPreviewDeployOutputSchema = exports.toolSetupPreviewDeployArgsSchema = exports.TOOL_SETUP_PREVIEW_DEPLOY_DESCRIPTION = void 0;
const zod_1 = require("zod");
exports.TOOL_SETUP_PREVIEW_DEPLOY_DESCRIPTION = [
    'Open a pull request that sets up Lightdash preview-project deploys for this project via GitHub Actions.',
    'Call this whenever the user wants to add Lightdash preview deploys — EITHER when they accept the offer surfaced by editDbtProject, OR when they ask directly (e.g. "set up preview deploys", "add the Lightdash preview GitHub Action", "deploy a preview project for each PR"). A prior writeback or offer is NOT required.',
    'It adds the canonical Lightdash preview workflow (a temporary preview project per pull request, torn down when the PR closes) on its own pull request.',
    'The target repository and dbt sub-folder are resolved server-side; this tool takes no arguments. The run is synchronous and can take a few minutes.',
].join(' ');
exports.toolSetupPreviewDeployArgsSchema = zod_1.z.object({});
exports.toolSetupPreviewDeployOutputSchema = zod_1.z.object({
    result: zod_1.z.string(),
    metadata: zod_1.z.discriminatedUnion('status', [
        zod_1.z.object({
            status: zod_1.z.literal('success'),
            prUrl: zod_1.z.string().nullable(),
        }),
        zod_1.z.object({
            status: zod_1.z.literal('error'),
        }),
    ]),
});
const isToolSetupPreviewDeployResult = (result) => result.toolType === 'built-in' &&
    result.toolName === 'setupPreviewDeploy' &&
    exports.toolSetupPreviewDeployOutputSchema.shape.metadata.safeParse(result.metadata)
        .success;
exports.isToolSetupPreviewDeployResult = isToolSetupPreviewDeployResult;
//# sourceMappingURL=toolSetupPreviewDeployArgs.js.map