/**
 * Pure Zod schemas for test planning tools.
 * This file should ONLY import from 'zod' and other files within toolLibrary/.
 */
import { z } from 'zod';
// ============================================================================
// Test Information Schemas
// ============================================================================
export const testInformationSchema = z.object({
    test_id: z.string().optional().meta({
        description: 'The ID of an existing test to edit instead of creating a new one. Only set this when the user clearly wants to modify an existing test — the default is always to create a new test. When editing, pre-fill the other fields (name, deployment, credentials, etc.) from the existing test via get_test_definition.',
    }),
    name: z.string().meta({
        description: 'The name of the test to be created. If provided sample tests from the workspace, analyze their naming conventions and patterns (formatting style, prefixes, structure) and follow the same convention. The name should be plain text and does not support markdown formatting.',
    }),
    description: z.string().optional().meta({
        description: 'A description of the test to be created. If provided sample tests from the workspace, analyze their description conventions and patterns (phrasing, length, level of detail) and follow the same convention. The description should be plain text and does not support markdown formatting.',
    }),
    deployment_id: z.string().optional().meta({
        description: 'The ID of the deployment to test. This is used to identify a URL to test against. PREFERRED: Picking a deployment_id is strongly preferred in most cases. If the information provided is not enough to identify a good choice of URL, you can leave this blank and use url_override instead. If the information provided is enough to identify an application, but not the specific environment or deployment for that application, you can choose a reasonable default deployment, preferring development environments over production environments.',
    }),
    test_case: z.string().meta({
        description: 'The test case description that clearly describes what the test should accomplish. This should be a concise but comprehensive description of the testing objective. If a good test case is provided, this should match it exactly.',
    }),
    url_override: z.string().optional().meta({
        description: 'A URL override to use for the test. Use this when: (1) you cannot find a suitable deployment_id in the workspace, or (2) the instructions explicitly request using a URL override. In most cases, if a deployment_id is specified, a url_override should NOT be specified. It is possible to have both deployment_id and url_override, in which case the Application and Environment for the deployment are respected, but the test will use this URL override instead. Having both should only be done if explicitly requested in the instructions.',
    }),
    credentials_id: z.string().optional().meta({
        description: 'The ID of the credentials to use for the test. Credentials supply a username, password, and potentially multi-factor authentication information if the test needs authentication information. If the information provided is not enough to determine that the test needs credentials, or not enough to identify a good choice of credentials, you should leave this blank.',
    }),
    branch_id: z.string().optional().meta({
        description: 'The ID of the branch to save the test to. Only set this when the user explicitly asks to save to a specific branch. Pick from the workspace context.',
    }),
    plan_id: z.string().optional().meta({
        description: 'The ID of the plan to add the test to after creation. Only set this when the user explicitly asks to add the test to a specific plan. Pick the ID from the available plans in the workspace context.',
    }),
    device_preset: z.string().optional().meta({
        description: 'Device emulation preset type (e.g. "iphone_15", "ipad_pro", "galaxy_s23"). Only set when the user explicitly asks for mobile device emulation. Mutually exclusive with viewport_width/viewport_height. Uses the same preset values as DeviceEmulationConfiguration.preset_type.',
    }),
    device_orientation: z
        .enum(['portrait_primary', 'portrait_secondary', 'landscape_primary', 'landscape_secondary'])
        .optional()
        .meta({
        description: 'Device orientation. Only valid alongside device_preset. Defaults to portrait_primary.',
    }),
});
export const testInformationGenerationResponseSchema = z.object({
    message: z.string().meta({
        description: 'A message to the user about the test information generation result. This should explain how the choices were made, if there was any uncertainty in choosing deployment or credentials, include follow-up questions if needed, etc.',
    }),
    testInformation: testInformationSchema,
    unsupported_settings_requested: z.array(z.string()).optional().meta({
        description: 'List of settings the user requested that cannot be configured by this tool and will need manual configuration in the test creation form. Only include settings that were explicitly or implicitly requested by the user in their instructions. Examples: "data table selection". Leave empty or omit if no unsupported settings were requested.',
    }),
});
// ============================================================================
// Test Plan Schemas
// ============================================================================
export const flowOptionSchema = z.object({
    flow_id: z.string().meta({
        description: 'The unique identifier of the flow to be used',
    }),
    flow_name: z.string().meta({
        description: 'The provided human-readable name of the flow',
    }),
    reasoning: z.string().meta({
        description: 'Explanation of why this flow is recommended for the task',
    }),
    preference: z.enum(['primary', 'secondary']).meta({
        description: 'Whether this is a primary or secondary flow option',
    }),
});
export const snippetOptionSchema = z.object({
    snippet_id: z.string().meta({
        description: 'The unique identifier of the code snippet to be used',
    }),
    snippet_name: z.string().meta({
        description: 'The human-readable name of the code snippet',
    }),
    reasoning: z.string().meta({
        description: 'Explanation of why this snippet is recommended for the task',
    }),
    preference: z.enum(['primary', 'secondary']).meta({
        description: 'Whether this is a primary or secondary snippet option',
    }),
});
/** A Zod recreation of the TestCreationTaskPlan type from the API client */
export const taskPlanSchema = z.object({
    task: z.string().meta({
        description: 'A clear description of the task to be performed',
    }),
    suggested_validation: z.string().meta({
        description: 'Description of what to validate when this task is complete. Focus on business outcomes and stable application states rather than transient UI elements or overly specific values. Avoid exact counts, specific prices, or dynamically generated content that varies between runs. Use semantic checks like "multiple results related to search term" instead of "Results(5) present".',
    }),
    suggested_flow_options: z.array(flowOptionSchema).meta({
        description: 'List of recommended flow options for this task',
    }),
    suggested_snippet_options: z.array(snippetOptionSchema).meta({
        description: 'List of recommended code snippet options for this task',
    }),
    implementation_notes: z.string().optional().meta({
        description: 'Task-specific implementation notes that provide guidance on how to accomplish this task. Should flag potential assertion pitfalls, such as noting when values will vary between runs (prices, counts, timestamps) and suggesting relationship-based validations instead.',
    }),
    screenshots_cited: z
        .array(z.object({
        test_run_id: z.string().meta({
            description: 'The ID of the test run that contains the screenshot',
        }),
        entry_id: z.number().meta({
            description: 'The entry ID for the screenshot',
        }),
    }))
        .meta({
        description: 'If the plan for this task was inspired by specific screenshots from a test run, list the associated test run IDs and screenshot entry IDs for the screenshots here. This will be used to cite the screenshots in the implementation notes. If no screenshots were useful for this task, leave this array empty.',
    }),
});
export const testPlanSchema = z.object({
    test_case: z.string().meta({
        description: 'Restatement of the given test case',
    }),
    tasks: z.array(taskPlanSchema).meta({
        description: 'List of tasks that need to be completed for the test case',
    }),
    implementation_notes: z.string().optional().meta({
        description: 'Notes about how to create a good test from the plan, including when to use variables and important validations. Should emphasize creating stable, business-aligned assertions that focus on outcomes rather than specific values that change between runs.',
    }),
});
//# sourceMappingURL=schemas.js.map