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: generate_autocomplete_results.rb
    path of file: ./repos/reports_kit/lib/reports_kit/reports
    
    the code of the file until where you have to start completion: module ReportsKit
  module Reports
    class GenerateAutocompleteResults
      attr_accessor :params, :properties, :filter_key, :filter, :context_params, :context_record

      def initialize(params, properties, context_record: nil)
        self.params = params
        self.properties = properties
        self.context_params = params[:context_params]
        self.filter_key = params[:key]
        self.filter = Reports::PropertiesToFilter.new(properties, context_record: context_record).perform(filter_key)
        self.context_record = context_record
      end

      def perform
        autocomplete_method_results = Reports::GenerateAutocompleteMethodResult
    
      def perform
        autocomplete_method_results = Reports::GenerateAutocompleteMethodResults.new(filter_key, properties, params).perform
        return autocomplete_method_results if autocomplete_method_results
        raise ArgumentError.new("Could not find a model for filter_key: '#{filter_key}'") unless model
        return autocomplete_results_method.call(params: params, context_record: context_record, relation: relation) if autocomplete_results_method
        results = filter.apply_contextual_filters(relation, context_params)
        results = results.limit(10_000)
        results = results.map { |result| { id: result.id, text: result.to_s } }
        results = results.sort_by { |result| result[:text].downcase }
        results = filter_results(results)
        results.first(100)
      end