-- Migration: Add ticket visibility levels
-- Run this migration to enable ticket visibility features

-- Add visibility columns to tickets table
ALTER TABLE tickets
ADD COLUMN visibility ENUM('public', 'internal', 'confidential') DEFAULT 'public' AFTER type,
ADD COLUMN visibility_groups VARCHAR(500) DEFAULT NULL AFTER visibility;

-- Create index for visibility filtering
CREATE INDEX idx_tickets_visibility ON tickets(visibility);

-- Example usage:
-- Public: All authenticated users can see the ticket
-- Internal: Only users in specified groups can see the ticket (visibility_groups contains comma-separated group names)
-- Confidential: Only creator, assignee, and admins can see the ticket
