require "devops-client/output/base"

module Output
  class Filters < Base

    def table
      headers, rows = create(@data)
      create_table(headers, rows, I18n.t("output.title.filter.list"))
    end

    def csv
      headers, rows = create(@data)
      create_csv(headers, rows)
    end

  private
    def create list
      abort(I18n.t("output.not_found.filter.list")) if @data.empty?
      headers_and_rows_for_array(@data, "image_id")
    end
  end
end
