-- Migration 002: Create resolution configuration table
-- Implements FR-3.1: Resolution order configuration
-- Date: 2026-02-08

-- Resolution configuration table
CREATE TABLE IF NOT EXISTS prompt_resolution_config (
    space_id TEXT PRIMARY KEY,
    included_spaces JSON,  -- Array of space IDs to search
    default_space_id TEXT,
    shared_space_id TEXT,
    max_generation_depth INTEGER DEFAULT 3,
    config JSON,  -- Additional configuration options
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Comments (for documentation)
-- prompt_resolution_config.space_id: Primary space for this configuration
-- prompt_resolution_config.included_spaces: Ordered array of space IDs for resolution search
-- prompt_resolution_config.default_space_id: Default space for common artifacts
-- prompt_resolution_config.shared_space_id: Team/shared space (optional)
-- prompt_resolution_config.max_generation_depth: Maximum nesting depth for generators
-- prompt_resolution_config.config: Additional JSON configuration
-- prompt_resolution_config.updated_at: Last configuration update
