/**
 * Governance Policy Types and Management
 *
 * Defines policy structures for governance engine evaluation.
 *
 * @packageDocumentation
 */
import type { ID, Timestamp } from '../common/types.js';
/**
 * Comparison operators for rule evaluation
 */
export declare const RULE_OPERATORS: readonly ["eq", "ne", "gt", "lt", "gte", "lte", "in", "contains", "matches"];
export type RuleOperator = (typeof RULE_OPERATORS)[number];
/**
 * Individual rule for policy evaluation
 */
export interface Rule {
    /** Field path to evaluate (e.g., 'intent.goal', 'context.resource') */
    field: string;
    /** Comparison operator */
    operator: RuleOperator;
    /** Value to compare against */
    value: unknown;
}
/**
 * Logical combination of rules
 */
export type RuleLogic = 'AND' | 'OR';
/**
 * Rule group with logical combination
 */
export interface RuleGroup {
    /** Logical operator for combining rules */
    logic: RuleLogic;
    /** Rules to evaluate */
    rules: Rule[];
}
/**
 * Policy effect - what happens when policy matches
 */
export type PolicyEffect = 'allow' | 'deny';
/**
 * Policy matching conditions
 */
export interface PolicyConditions {
    /** Match on specific actions/goals */
    actions?: string[];
    /** Match on resource patterns */
    resources?: string[];
    /** Match on intent types */
    intentTypes?: string[];
    /** Match on entity types */
    entityTypes?: string[];
    /** Custom conditions as rule group */
    custom?: RuleGroup;
}
/**
 * Policy definition for governance evaluation
 */
export interface Policy {
    /** Unique policy identifier */
    id: ID;
    /** Human-readable policy name */
    name: string;
    /** Policy description */
    description?: string;
    /** Matching rules as a rule group */
    rules: RuleGroup;
    /** Effect when policy matches */
    effect: PolicyEffect;
    /** Priority (lower number = higher priority) */
    priority: number;
    /** Optional conditions for policy matching */
    conditions?: PolicyConditions;
    /** Is policy enabled */
    enabled: boolean;
    /** Policy metadata */
    metadata?: Record<string, unknown>;
    /** Creation timestamp */
    createdAt?: Timestamp;
    /** Update timestamp */
    updatedAt?: Timestamp;
}
/**
 * A set of policies for evaluation
 */
export interface PolicySet {
    /** Unique identifier */
    id: ID;
    /** Policy set name */
    name: string;
    /** Policies in this set */
    policies: Policy[];
    /** Default effect if no policies match */
    defaultEffect: PolicyEffect;
    /** Evaluation strategy */
    evaluationStrategy: 'first-match' | 'all-match' | 'deny-overrides';
}
/**
 * Conflict resolution strategy
 */
export type ConflictResolutionStrategy = 'deny-overrides' | 'allow-overrides' | 'first-match' | 'priority-based';
/**
 * Resolve policy conflicts
 */
export declare function resolveConflicts(effects: {
    effect: PolicyEffect;
    priority: number;
}[], strategy: ConflictResolutionStrategy): PolicyEffect;
/**
 * PolicySet manager for organizing and querying policies
 */
export declare class PolicySetManager {
    private policySets;
    /**
     * Add a policy set
     */
    addPolicySet(policySet: PolicySet): void;
    /**
     * Remove a policy set
     */
    removePolicySet(id: ID): boolean;
    /**
     * Get a policy set by ID
     */
    getPolicySet(id: ID): PolicySet | undefined;
    /**
     * Get all policy sets
     */
    getAllPolicySets(): PolicySet[];
    /**
     * Get all enabled policies from all sets, sorted by priority
     */
    getAllEnabledPolicies(): Policy[];
    /**
     * Find policies matching conditions
     */
    findMatchingPolicies(action?: string, resource?: string, intentType?: string): Policy[];
    /**
     * Clear all policy sets
     */
    clear(): void;
}
/**
 * Create a new policy with defaults
 */
export declare function createPolicy(partial: Partial<Policy> & Pick<Policy, 'id' | 'name' | 'rules' | 'effect'>): Policy;
/**
 * Create a new policy set with defaults
 */
export declare function createPolicySet(partial: Partial<PolicySet> & Pick<PolicySet, 'id' | 'name' | 'policies'>): PolicySet;
//# sourceMappingURL=policy.d.ts.map