/**
 * Pure Zod schemas that are shared across multiple tool definitions.
 * This file should ONLY import from 'zod' and other files within toolLibrary/.
 */
import { z } from '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.
 */
export const 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',
];
export const comparisonTypeEnum = z.enum(COMPARISON_TYPES);
// ============================================================================
// Geometry Schemas
// ============================================================================
export const boundingBoxSchema = z.object({
    top: z.number(),
    left: z.number(),
    bottom: z.number(),
    right: z.number(),
});
export const targetPointSchema = z.object({
    x: z.number(),
    y: z.number(),
});
// ============================================================================
// Flow Schemas
// ============================================================================
export const flowInfoSchema = z.object({
    invariant_id: z.string().meta({
        description: 'The ID of the flow',
    }),
    application_id: z.string().optional().meta({
        description: 'The ID of the application associated with the flow',
    }),
    description: z.string().optional().meta({
        description: 'The description of the flow',
    }),
    usage_count: z.number().optional().meta({
        description: 'The number of tests in which the flow has been used',
    }),
    creation_url: z.string().optional().meta({
        description: 'The URL of the page where the flow was created',
    }),
    preconditions: z.string().optional().meta({
        description: 'The preconditions of the flow',
    }),
    summary: z.string().optional().meta({
        description: 'The summary of the flow',
    }),
    steps: z.string().optional().meta({
        description: 'The steps of the flow',
    }),
    snippets: z.string().optional().meta({
        description: 'Description of the snippets referenced in the flow',
    }),
    parameters: z
        .array(z.object({
        name: z.string().meta({
            description: 'The name of the parameter',
        }),
        default_value: 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
// ============================================================================
export const snippetInfoSchema = z.object({
    invariant_id: z.string().meta({
        description: 'The ID of the snippet',
    }),
    name: z.string().optional().meta({
        description: 'The name of the snippet',
    }),
    description: z.string().optional().meta({
        description: 'The description of the snippet',
    }),
    snippet_type: z.string().optional().meta({
        description: 'The type of the snippet (e.g., javascript)',
    }),
    body: 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: 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: z.number().optional().meta({
        description: 'The character length of the (stripped) original body. Only set when body_truncated is true.',
    }),
    parameters: z
        .array(z.object({
        name: z.string().meta({
            description: 'The name of the parameter',
        }),
        default_value: 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.
 */
export const sourceControlContextSchema = z.object({
    revision: z.string().optional().meta({ description: 'Source code revision/commit SHA' }),
    branchName: z.string().optional().meta({ description: 'Git branch name' }),
    commitUsername: z.string().optional().meta({ description: 'Username of the commit author' }),
    repositoryUrl: z.string().optional().meta({ description: 'Repository URL' }),
    repositoryName: z.string().optional().meta({ description: 'Repository name' }),
    pullRequestUrl: z.string().optional().meta({ description: 'Pull request URL if applicable' }),
    pullRequestTitle: z.string().optional().meta({ description: 'Pull request title if applicable' }),
});
//# sourceMappingURL=schemas.js.map