{"-- Create table for notification labels used in alerts
CREATE TABLE IF NOT EXISTS public.notification_labels (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  type TEXT NOT NULL, -- e.g., 'audio', 'whatsapp', 'push', 'email'
  name_ar TEXT NOT NULL,
  name_en TEXT,
  is_active BOOLEAN NOT NULL DEFAULT true,
  created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
  updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
  created_by UUID
)","-- Enable RLS
ALTER TABLE public.notification_labels ENABLE ROW LEVEL SECURITY","-- Policies
CREATE POLICY \"Super admin can manage notification labels\"
ON public.notification_labels
AS PERMISSIVE
FOR ALL
TO PUBLIC
USING (is_current_user_super_admin())
WITH CHECK (is_current_user_super_admin())","CREATE POLICY \"Users can view active notification labels\"
ON public.notification_labels
AS PERMISSIVE
FOR SELECT
TO PUBLIC
USING (is_active = true)","-- Trigger to maintain updated_at
DROP TRIGGER IF EXISTS update_notification_labels_updated_at ON public.notification_labels","CREATE TRIGGER update_notification_labels_updated_at
BEFORE UPDATE ON public.notification_labels
FOR EACH ROW
EXECUTE FUNCTION public.update_modified_column()"}