/**
 * Deployment Verification Types
 *
 * Types for canary deployment, health monitoring, and rollback detection.
 *
 * @module scanners/deploy/types
 */
import { z } from "zod";
/**
 * Canary deployment config
 */
export const CanaryConfigSchema = z.object({
    enabled: z.boolean().default(true),
    trafficPercent: z.number().min(0).max(100).default(10),
    duration: z.string().default("10m").describe("How long to run canary before promotion"),
    thresholds: z.object({
        errorRate: z.number().default(0.01).describe("Max error rate to pass"),
        p95Latency: z.number().default(500).describe("Max p95 latency (ms)"),
        healthCheckFailures: z.number().default(2).describe("Max consecutive health check failures"),
    }).optional(),
    rollbackOnFailure: z.boolean().default(true),
});
/**
 * Smoke test definition
 */
export const SmokeTestSchema = z.object({
    name: z.string(),
    endpoint: z.string(),
    method: z.enum(["GET", "POST", "PUT", "DELETE"]).default("GET"),
    expectedStatus: z.number().default(200),
    timeout: z.number().optional().default(10000),
    headers: z.record(z.string()).optional(),
    body: z.record(z.unknown()).optional(),
    assertions: z.array(z.object({
        type: z.enum(["status", "body", "header", "latency"]),
        path: z.string().optional(),
        operator: z.enum(["eq", "ne", "gt", "lt", "contains", "matches"]),
        value: z.union([z.string(), z.number()]),
    })).optional(),
});
/**
 * Deployment config (YAML schema)
 */
export const DeployConfigSchema = z.object({
    provider: z.enum(["vercel", "aws", "gcp", "railway", "render", "fly"]).optional(),
    healthEndpoints: z.array(z.string()).default(["/", "/api/health"]),
    smokeTests: z.array(SmokeTestSchema).optional(),
    canary: CanaryConfigSchema.optional(),
    rollback: z.object({
        autoRollback: z.boolean().default(true),
        retainVersions: z.number().default(5),
    }).optional(),
    notifications: z.object({
        slack: z.string().optional(),
        email: z.array(z.string()).optional(),
    }).optional(),
});
//# sourceMappingURL=types.js.map