You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: reports_controller.rb
    path of file: ./repos/zammad/app/controllers
    
    the code of the file until where you have to start completion: # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/

class ReportsController < ApplicationController
  prepend_before_action :authenticate_and_authorize!

  # GET /api/reports/config
  def reporting_config
    if !Report.enabled?
      render json: {
        error: __('Elasticsearch needs to be configured!'),
      }
      return
    end
    render json: {
      config:   Report.config,
      profiles: Report::Profile.list,
    
    
  def generate
    get_params = params_all
    return if !get_params

    result = {}
    get_params[:metric][:backend].each do |backend|
      condition = get_params[:profile].condition
      if backend[:condition]
        backend[:condition].merge(condition)
      else
        backend[:condition] = condition
      end
      next if !backend[:adapter]

      result[backend[:name]] = backend[:adapter].aggs(
        range_start:     get_params[:start],
        range_end:       get_params[:stop],
        interval:        get_params[:range],
        selector:        backend[:condition],
        params:          backend[:params],
        timezone:        get_params[:timezone],
        timezone_offset: get_params[:timezone_offset],
        current_user:    current_user
      )
    end