-- Migration 025: Gap Analysis Projects
-- Product profiles for regulatory gap analysis.

CREATE TABLE IF NOT EXISTS compliance.gap_projects (
    id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    tenant_id UUID NOT NULL,
    name VARCHAR(200) NOT NULL,
    description TEXT DEFAULT '',
    product_type VARCHAR(50) NOT NULL DEFAULT 'software',
    technologies JSONB DEFAULT '[]',
    data_processing JSONB DEFAULT '[]',
    markets JSONB DEFAULT '["EU"]',
    connected_to_internet BOOLEAN DEFAULT false,
    has_software_updates BOOLEAN DEFAULT false,
    uses_ai BOOLEAN DEFAULT false,
    processes_personal_data BOOLEAN DEFAULT false,
    is_critical_infra_supplier BOOLEAN DEFAULT false,
    existing_certifications JSONB DEFAULT '[]',
    last_analysis_at TIMESTAMPTZ,
    created_at TIMESTAMPTZ DEFAULT NOW(),
    updated_at TIMESTAMPTZ DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_gap_projects_tenant ON compliance.gap_projects(tenant_id);
