-- Add Vimeo video hosting fields to sub_course_videos table
ALTER TABLE sub_course_videos 
ADD COLUMN IF NOT EXISTS vimeo_id TEXT,
ADD COLUMN IF NOT EXISTS vimeo_embed_url TEXT,
ADD COLUMN IF NOT EXISTS vimeo_player_html TEXT,
ADD COLUMN IF NOT EXISTS vimeo_status TEXT DEFAULT 'pending',
ADD COLUMN IF NOT EXISTS video_host_provider TEXT DEFAULT 'DIRECT';

-- Create index on vimeo_id for faster lookups
CREATE INDEX IF NOT EXISTS idx_sub_course_videos_vimeo_id ON sub_course_videos(vimeo_id) WHERE vimeo_id IS NOT NULL;

-- Add comment for documentation
COMMENT ON COLUMN sub_course_videos.vimeo_id IS 'Vimeo video ID for videos hosted on Vimeo';
COMMENT ON COLUMN sub_course_videos.vimeo_embed_url IS 'Vimeo player embed URL';
COMMENT ON COLUMN sub_course_videos.vimeo_player_html IS 'Vimeo iframe embed HTML code';
COMMENT ON COLUMN sub_course_videos.vimeo_status IS 'Vimeo video status: pending, uploading, transcoding, available, error';
COMMENT ON COLUMN sub_course_videos.video_host_provider IS 'Video hosting provider: DIRECT or VIMEO';
