-- Migration: Add solution column to urt_subcodes
-- Version: 010
-- Date: 2026-01-25
-- Description: Add solution column to store actionable recommendations for each URT subcode

-- Add solution column for actionable business recommendations
ALTER TABLE pipeline.urt_subcodes
ADD COLUMN IF NOT EXISTS solution TEXT;

-- Add comment describing the column
COMMENT ON COLUMN pipeline.urt_subcodes.solution IS
'Actionable business recommendation for addressing issues related to this subcode';

-- Also add marketing_angle column for strengths
ALTER TABLE pipeline.urt_subcodes
ADD COLUMN IF NOT EXISTS marketing_angle TEXT;

COMMENT ON COLUMN pipeline.urt_subcodes.marketing_angle IS
'Marketing suggestion when this subcode appears as a strength (high positive sentiment)';

-- Add complexity column to help with opportunity matrix
ALTER TABLE pipeline.urt_subcodes
ADD COLUMN IF NOT EXISTS solution_complexity VARCHAR(10) DEFAULT 'medium';

COMMENT ON COLUMN pipeline.urt_subcodes.solution_complexity IS
'Complexity of implementing the solution: simple, medium, complex';

-- Add constraint for valid complexity values
ALTER TABLE pipeline.urt_subcodes
ADD CONSTRAINT valid_solution_complexity
CHECK (solution_complexity IN ('simple', 'medium', 'complex'));
