# frozen_string_literal: true

module Zoom
  module Actions
    module User
      def user_settings_update(*args)
        params = Zoom::Params.new(Utils.extract_options!(args))
        permitted_in_meeting_params = %i[
          auto_saving_chat
          co_host
          non_verbal_feedback
          breakout_room
          group_hd
          far_end_camera_control
          allow_live_streaming
        ]
        permitted_params = { in_meeting: permitted_in_meeting_params }
        params.require(:id).permit permitted_params
        request_body = params.except(:id).to_json
        resp = self.class.patch("/users/#{params[:id]}/settings", body: request_body, headers: request_headers)
        Utils.parse_response resp
      end
    end
  end
end