-- Add RLS policies to enable Realtime for moderation tables

-- Content Submissions
CREATE POLICY "realtime_admin_access_content_submissions"
ON public.content_submissions
FOR SELECT
TO supabase_realtime_admin
USING (true);

CREATE POLICY "moderators_realtime_content_submissions"
ON public.content_submissions
FOR SELECT
TO authenticated
USING (check_realtime_access());

-- Submission Items
CREATE POLICY "realtime_admin_access_submission_items"
ON public.submission_items
FOR SELECT
TO supabase_realtime_admin
USING (true);

CREATE POLICY "moderators_realtime_submission_items"
ON public.submission_items
FOR SELECT
TO authenticated
USING (check_realtime_access());

-- Reports
CREATE POLICY "realtime_admin_access_reports"
ON public.reports
FOR SELECT
TO supabase_realtime_admin
USING (true);

CREATE POLICY "moderators_realtime_reports"
ON public.reports
FOR SELECT
TO authenticated
USING (check_realtime_access());

-- Reviews
CREATE POLICY "realtime_admin_access_reviews"
ON public.reviews
FOR SELECT
TO supabase_realtime_admin
USING (true);

CREATE POLICY "moderators_realtime_reviews"
ON public.reviews
FOR SELECT
TO authenticated
USING (check_realtime_access());