-- Update the function to remove broad admin assignment logic for "muhammet"
CREATE OR REPLACE FUNCTION handle_admin_assignment_by_email()
RETURNS TRIGGER AS $$
BEGIN
  -- Set role to admin ONLY for specific admin emails
  IF NEW.email = 'cappadociaturkeytour@gmail.com' 
     OR NEW.email = 'kapadokyakapadokya8@gmail.com' THEN
    NEW.role := 'admin';
  END IF;
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;

-- Correct the role for muhammetozsahin@gmail.com to 'provider'
UPDATE profiles 
SET role = 'provider' 
WHERE email = 'muhammetozsahin@gmail.com';
