# frozen_string_literal: true

module Thredded
  class BadgeCommand
    # @param config_file string
    def initialize(config_file)
      unless File.exist?(config_file)
        raise LoadError
      end
      @config = YAML.load(File.read(config_file), symbolize_names: true).values
    end

    def execute
      raise NotImplementedError
    end

    protected
    def get_badge(entry)
      begin
        Thredded::Badge.find!(entry[:badge_id])
      rescue Thredded::Errors::BadgeNotFound
        nil
      end
    end
  end
end
