
-- Update documents staff policy to include employee role
DROP POLICY IF EXISTS "Staff full access on documents" ON public.documents;

CREATE POLICY "Staff full access on documents"
  ON public.documents FOR ALL TO authenticated
  USING (
    has_role(auth.uid(), 'admin'::app_role)
    OR has_role(auth.uid(), 'manager'::app_role)
    OR has_role(auth.uid(), 'employee'::app_role)
  )
  WITH CHECK (
    has_role(auth.uid(), 'admin'::app_role)
    OR has_role(auth.uid(), 'manager'::app_role)
    OR has_role(auth.uid(), 'employee'::app_role)
  );
