class Admins::PageThemesQuery < ApplicationQuery
  include CustomSortable

  attr_reader :params

  sort_columns :created_at, default_by: :created_at, default_direction: :desc

  def initialize(params)
    @params = params
  end

  def call
    language_frame = params[:language_frame].blank? ? [0..99] : params[:language_frame]
    page_themes = PageTheme.where(language_frame: language_frame)
    custom_sort(page_themes, params[:sort_by], params[:sort_direction])
  end
end