/**
 * BASIS Rule Parser
 *
 * Parses YAML/JSON rule definitions into executable rules.
 */
import { z } from 'zod';
import type { RuleNamespace } from './types.js';
/**
 * Schema for individual rule
 */
declare const ruleSchema: z.ZodObject<{
    id: z.ZodString;
    name: z.ZodString;
    description: z.ZodDefault<z.ZodString>;
    priority: z.ZodDefault<z.ZodNumber>;
    enabled: z.ZodDefault<z.ZodBoolean>;
    when: z.ZodObject<{
        intentType: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
        entityType: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
        conditions: z.ZodOptional<z.ZodArray<z.ZodObject<{
            field: z.ZodString;
            operator: z.ZodEnum<["equals", "not_equals", "greater_than", "less_than", "greater_than_or_equal", "less_than_or_equal", "in", "not_in", "contains", "not_contains", "matches", "exists", "not_exists"]>;
            value: z.ZodUnknown;
        }, "strip", z.ZodTypeAny, {
            value?: unknown;
            field?: string;
            operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
        }, {
            value?: unknown;
            field?: string;
            operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
        }>, "many">>;
    }, "strip", z.ZodTypeAny, {
        intentType?: string | string[];
        conditions?: {
            value?: unknown;
            field?: string;
            operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
        }[];
        entityType?: string | string[];
    }, {
        intentType?: string | string[];
        conditions?: {
            value?: unknown;
            field?: string;
            operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
        }[];
        entityType?: string | string[];
    }>;
    evaluate: z.ZodArray<z.ZodObject<{
        condition: z.ZodString;
        result: z.ZodEnum<["allow", "deny", "escalate", "limit", "monitor", "terminate"]>;
        reason: z.ZodOptional<z.ZodString>;
        escalation: z.ZodOptional<z.ZodObject<{
            to: z.ZodString;
            timeout: z.ZodString;
            requireJustification: z.ZodOptional<z.ZodBoolean>;
            autoDenyOnTimeout: z.ZodOptional<z.ZodBoolean>;
        }, "strip", z.ZodTypeAny, {
            timeout?: string;
            to?: string;
            requireJustification?: boolean;
            autoDenyOnTimeout?: boolean;
        }, {
            timeout?: string;
            to?: string;
            requireJustification?: boolean;
            autoDenyOnTimeout?: boolean;
        }>>;
    }, "strip", z.ZodTypeAny, {
        result?: "limit" | "allow" | "deny" | "escalate" | "monitor" | "terminate";
        reason?: string;
        escalation?: {
            timeout?: string;
            to?: string;
            requireJustification?: boolean;
            autoDenyOnTimeout?: boolean;
        };
        condition?: string;
    }, {
        result?: "limit" | "allow" | "deny" | "escalate" | "monitor" | "terminate";
        reason?: string;
        escalation?: {
            timeout?: string;
            to?: string;
            requireJustification?: boolean;
            autoDenyOnTimeout?: boolean;
        };
        condition?: string;
    }>, "many">;
    metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, "strip", z.ZodTypeAny, {
    id?: string;
    name?: string;
    description?: string;
    enabled?: boolean;
    priority?: number;
    metadata?: Record<string, unknown>;
    evaluate?: {
        result?: "limit" | "allow" | "deny" | "escalate" | "monitor" | "terminate";
        reason?: string;
        escalation?: {
            timeout?: string;
            to?: string;
            requireJustification?: boolean;
            autoDenyOnTimeout?: boolean;
        };
        condition?: string;
    }[];
    when?: {
        intentType?: string | string[];
        conditions?: {
            value?: unknown;
            field?: string;
            operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
        }[];
        entityType?: string | string[];
    };
}, {
    id?: string;
    name?: string;
    description?: string;
    enabled?: boolean;
    priority?: number;
    metadata?: Record<string, unknown>;
    evaluate?: {
        result?: "limit" | "allow" | "deny" | "escalate" | "monitor" | "terminate";
        reason?: string;
        escalation?: {
            timeout?: string;
            to?: string;
            requireJustification?: boolean;
            autoDenyOnTimeout?: boolean;
        };
        condition?: string;
    }[];
    when?: {
        intentType?: string | string[];
        conditions?: {
            value?: unknown;
            field?: string;
            operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
        }[];
        entityType?: string | string[];
    };
}>;
/**
 * Schema for rule namespace
 */
declare const namespaceSchema: z.ZodObject<{
    namespace: z.ZodString;
    description: z.ZodDefault<z.ZodString>;
    version: z.ZodDefault<z.ZodString>;
    rules: z.ZodArray<z.ZodObject<{
        id: z.ZodString;
        name: z.ZodString;
        description: z.ZodDefault<z.ZodString>;
        priority: z.ZodDefault<z.ZodNumber>;
        enabled: z.ZodDefault<z.ZodBoolean>;
        when: z.ZodObject<{
            intentType: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
            entityType: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
            conditions: z.ZodOptional<z.ZodArray<z.ZodObject<{
                field: z.ZodString;
                operator: z.ZodEnum<["equals", "not_equals", "greater_than", "less_than", "greater_than_or_equal", "less_than_or_equal", "in", "not_in", "contains", "not_contains", "matches", "exists", "not_exists"]>;
                value: z.ZodUnknown;
            }, "strip", z.ZodTypeAny, {
                value?: unknown;
                field?: string;
                operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
            }, {
                value?: unknown;
                field?: string;
                operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
            }>, "many">>;
        }, "strip", z.ZodTypeAny, {
            intentType?: string | string[];
            conditions?: {
                value?: unknown;
                field?: string;
                operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
            }[];
            entityType?: string | string[];
        }, {
            intentType?: string | string[];
            conditions?: {
                value?: unknown;
                field?: string;
                operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
            }[];
            entityType?: string | string[];
        }>;
        evaluate: z.ZodArray<z.ZodObject<{
            condition: z.ZodString;
            result: z.ZodEnum<["allow", "deny", "escalate", "limit", "monitor", "terminate"]>;
            reason: z.ZodOptional<z.ZodString>;
            escalation: z.ZodOptional<z.ZodObject<{
                to: z.ZodString;
                timeout: z.ZodString;
                requireJustification: z.ZodOptional<z.ZodBoolean>;
                autoDenyOnTimeout: z.ZodOptional<z.ZodBoolean>;
            }, "strip", z.ZodTypeAny, {
                timeout?: string;
                to?: string;
                requireJustification?: boolean;
                autoDenyOnTimeout?: boolean;
            }, {
                timeout?: string;
                to?: string;
                requireJustification?: boolean;
                autoDenyOnTimeout?: boolean;
            }>>;
        }, "strip", z.ZodTypeAny, {
            result?: "limit" | "allow" | "deny" | "escalate" | "monitor" | "terminate";
            reason?: string;
            escalation?: {
                timeout?: string;
                to?: string;
                requireJustification?: boolean;
                autoDenyOnTimeout?: boolean;
            };
            condition?: string;
        }, {
            result?: "limit" | "allow" | "deny" | "escalate" | "monitor" | "terminate";
            reason?: string;
            escalation?: {
                timeout?: string;
                to?: string;
                requireJustification?: boolean;
                autoDenyOnTimeout?: boolean;
            };
            condition?: string;
        }>, "many">;
        metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    }, "strip", z.ZodTypeAny, {
        id?: string;
        name?: string;
        description?: string;
        enabled?: boolean;
        priority?: number;
        metadata?: Record<string, unknown>;
        evaluate?: {
            result?: "limit" | "allow" | "deny" | "escalate" | "monitor" | "terminate";
            reason?: string;
            escalation?: {
                timeout?: string;
                to?: string;
                requireJustification?: boolean;
                autoDenyOnTimeout?: boolean;
            };
            condition?: string;
        }[];
        when?: {
            intentType?: string | string[];
            conditions?: {
                value?: unknown;
                field?: string;
                operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
            }[];
            entityType?: string | string[];
        };
    }, {
        id?: string;
        name?: string;
        description?: string;
        enabled?: boolean;
        priority?: number;
        metadata?: Record<string, unknown>;
        evaluate?: {
            result?: "limit" | "allow" | "deny" | "escalate" | "monitor" | "terminate";
            reason?: string;
            escalation?: {
                timeout?: string;
                to?: string;
                requireJustification?: boolean;
                autoDenyOnTimeout?: boolean;
            };
            condition?: string;
        }[];
        when?: {
            intentType?: string | string[];
            conditions?: {
                value?: unknown;
                field?: string;
                operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
            }[];
            entityType?: string | string[];
        };
    }>, "many">;
}, "strip", z.ZodTypeAny, {
    version?: string;
    description?: string;
    namespace?: string;
    rules?: {
        id?: string;
        name?: string;
        description?: string;
        enabled?: boolean;
        priority?: number;
        metadata?: Record<string, unknown>;
        evaluate?: {
            result?: "limit" | "allow" | "deny" | "escalate" | "monitor" | "terminate";
            reason?: string;
            escalation?: {
                timeout?: string;
                to?: string;
                requireJustification?: boolean;
                autoDenyOnTimeout?: boolean;
            };
            condition?: string;
        }[];
        when?: {
            intentType?: string | string[];
            conditions?: {
                value?: unknown;
                field?: string;
                operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
            }[];
            entityType?: string | string[];
        };
    }[];
}, {
    version?: string;
    description?: string;
    namespace?: string;
    rules?: {
        id?: string;
        name?: string;
        description?: string;
        enabled?: boolean;
        priority?: number;
        metadata?: Record<string, unknown>;
        evaluate?: {
            result?: "limit" | "allow" | "deny" | "escalate" | "monitor" | "terminate";
            reason?: string;
            escalation?: {
                timeout?: string;
                to?: string;
                requireJustification?: boolean;
                autoDenyOnTimeout?: boolean;
            };
            condition?: string;
        }[];
        when?: {
            intentType?: string | string[];
            conditions?: {
                value?: unknown;
                field?: string;
                operator?: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "not_contains" | "matches" | "in" | "not_in" | "greater_than_or_equal" | "less_than_or_equal" | "exists" | "not_exists";
            }[];
            entityType?: string | string[];
        };
    }[];
}>;
export type RuleDefinition = z.infer<typeof ruleSchema>;
export type NamespaceDefinition = z.infer<typeof namespaceSchema>;
/**
 * Parse a rule namespace from a definition object
 */
export declare function parseNamespace(definition: unknown): RuleNamespace;
/**
 * Validate a rule definition
 */
export declare function validateRule(definition: unknown): {
    valid: boolean;
    errors: string[];
};
/**
 * Validate a namespace definition
 */
export declare function validateNamespace(definition: unknown): {
    valid: boolean;
    errors: string[];
};
export {};
//# sourceMappingURL=parser.d.ts.map