"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sourceControlContextSchema = exports.snippetInfoSchema = exports.flowInfoSchema = exports.targetPointSchema = exports.boundingBoxSchema = exports.comparisonTypeEnum = exports.COMPARISON_TYPES = void 0;
/**
 * Pure Zod schemas that are shared across multiple tool definitions.
 * This file should ONLY import from 'zod' and other files within toolLibrary/.
 */
var zod_1 = require("zod");
// ============================================================================
// Comparison / Assertion Schemas
// ============================================================================
/**
 * Shared list of comparison operators available across mabl assertion step types
 * (variable assertions, API response assertions, DB query assertions, conditionals, etc.).
 * Mirrors `comparisonTypeEnum` in mabl-cli/test-model/src/validator/schemas/condition-descriptor.ts
 * and `ComparisonType` in mabl-cli/test-model/src/types/ConditionDescriptor.ts.
 */
exports.COMPARISON_TYPES = [
    'equals',
    'does_not_equal',
    'contains',
    'does_not_contain',
    'starts_with',
    'starts_without',
    'ends_with',
    'ends_without',
    'greater_than',
    'less_than',
    'greater_than_or_equals',
    'less_than_or_equals',
    'matches_regex',
];
exports.comparisonTypeEnum = zod_1.z.enum(exports.COMPARISON_TYPES);
// ============================================================================
// Geometry Schemas
// ============================================================================
exports.boundingBoxSchema = zod_1.z.object({
    top: zod_1.z.number(),
    left: zod_1.z.number(),
    bottom: zod_1.z.number(),
    right: zod_1.z.number(),
});
exports.targetPointSchema = zod_1.z.object({
    x: zod_1.z.number(),
    y: zod_1.z.number(),
});
// ============================================================================
// Flow Schemas
// ============================================================================
exports.flowInfoSchema = zod_1.z.object({
    invariant_id: zod_1.z.string().meta({
        description: 'The ID of the flow',
    }),
    application_id: zod_1.z.string().optional().meta({
        description: 'The ID of the application associated with the flow',
    }),
    description: zod_1.z.string().optional().meta({
        description: 'The description of the flow',
    }),
    usage_count: zod_1.z.number().optional().meta({
        description: 'The number of tests in which the flow has been used',
    }),
    creation_url: zod_1.z.string().optional().meta({
        description: 'The URL of the page where the flow was created',
    }),
    preconditions: zod_1.z.string().optional().meta({
        description: 'The preconditions of the flow',
    }),
    summary: zod_1.z.string().optional().meta({
        description: 'The summary of the flow',
    }),
    steps: zod_1.z.string().optional().meta({
        description: 'The steps of the flow',
    }),
    snippets: zod_1.z.string().optional().meta({
        description: 'Description of the snippets referenced in the flow',
    }),
    parameters: zod_1.z
        .array(zod_1.z.object({
        name: zod_1.z.string().meta({
            description: 'The name of the parameter',
        }),
        default_value: zod_1.z.string().optional().meta({
            description: 'The default value of the parameter',
        }),
    }))
        .meta({
        description: 'The parameters of the flow, which will set variables that can be used inside the flow',
    }),
});
// ============================================================================
// Snippet Schemas
// ============================================================================
exports.snippetInfoSchema = zod_1.z.object({
    invariant_id: zod_1.z.string().meta({
        description: 'The ID of the snippet',
    }),
    name: zod_1.z.string().optional().meta({
        description: 'The name of the snippet',
    }),
    description: zod_1.z.string().optional().meta({
        description: 'The description of the snippet',
    }),
    snippet_type: zod_1.z.string().optional().meta({
        description: 'The type of the snippet (e.g., javascript)',
    }),
    body: zod_1.z.string().optional().meta({
        description: 'The decoded body/code of the snippet. Omitted when body_truncated is true — call get_snippet_details with invariant_id to fetch the full body.',
    }),
    body_truncated: zod_1.z.boolean().optional().meta({
        description: 'True when the snippet body was stripped because it exceeded the inline size limit. Fetch the full body via get_snippet_details if it is needed.',
    }),
    body_length: zod_1.z.number().optional().meta({
        description: 'The character length of the (stripped) original body. Only set when body_truncated is true.',
    }),
    parameters: zod_1.z
        .array(zod_1.z.object({
        name: zod_1.z.string().meta({
            description: 'The name of the parameter',
        }),
        default_value: zod_1.z.string().optional().meta({
            description: 'The default value of the parameter',
        }),
    }))
        .meta({
        description: 'The parameters of the snippet',
    }),
});
// ============================================================================
// Source Control Schemas
// ============================================================================
/**
 * Schema for source control context - shared across deployment and test run analysis tools.
 * Contains information about the git revision, branch, PR, and repository.
 */
exports.sourceControlContextSchema = zod_1.z.object({
    revision: zod_1.z.string().optional().meta({ description: 'Source code revision/commit SHA' }),
    branchName: zod_1.z.string().optional().meta({ description: 'Git branch name' }),
    commitUsername: zod_1.z.string().optional().meta({ description: 'Username of the commit author' }),
    repositoryUrl: zod_1.z.string().optional().meta({ description: 'Repository URL' }),
    repositoryName: zod_1.z.string().optional().meta({ description: 'Repository name' }),
    pullRequestUrl: zod_1.z.string().optional().meta({ description: 'Pull request URL if applicable' }),
    pullRequestTitle: zod_1.z.string().optional().meta({ description: 'Pull request title if applicable' }),
});
//# sourceMappingURL=schemas.js.map