# frozen_string_literal: true

module RecommendationType
  GUMROAD_DISCOVER_RECOMMENDATION = "discover"
  GUMROAD_SEARCH_RECOMMENDATION = "search"
  GUMROAD_RECEIPT_RECOMMENDATION = "receipt"
  GUMROAD_LIBRARY_RECOMMENDATION = "library"
  GUMROAD_MORE_LIKE_THIS_RECOMMENDATION = "more_like_this"
  GUMROAD_PRODUCTS_FOR_YOU_RECOMMENDATION = "products_for_you"
  GUMROAD_STAFF_PICKS_RECOMMENDATION = "staff_picks"
  GUMROAD_DISCOVER_WISHLIST_RECOMMENDATION = "discover_wishlist"
  PRODUCT_RECOMMENDATION = "product"
  WISHLIST_RECOMMENDATION = "wishlist"

  ALL = [
    GUMROAD_DISCOVER_RECOMMENDATION,
    GUMROAD_SEARCH_RECOMMENDATION,
    GUMROAD_RECEIPT_RECOMMENDATION,
    GUMROAD_LIBRARY_RECOMMENDATION,
    GUMROAD_STAFF_PICKS_RECOMMENDATION,
    PRODUCT_RECOMMENDATION,
    WISHLIST_RECOMMENDATION,
  ].freeze
  private_constant :ALL

  def self.all
    ALL
  end

  def self.is_product_recommendation?(rec_type)
    [
      GUMROAD_DISCOVER_RECOMMENDATION,
      GUMROAD_SEARCH_RECOMMENDATION,
      GUMROAD_RECEIPT_RECOMMENDATION,
      GUMROAD_LIBRARY_RECOMMENDATION,
      GUMROAD_MORE_LIKE_THIS_RECOMMENDATION,
      GUMROAD_PRODUCTS_FOR_YOU_RECOMMENDATION,
      GUMROAD_STAFF_PICKS_RECOMMENDATION,
      WISHLIST_RECOMMENDATION,
    ].exclude?(rec_type)
  end

  def self.is_free_recommendation_type?(rec_typ)
    [GUMROAD_LIBRARY_RECOMMENDATION, GUMROAD_MORE_LIKE_THIS_RECOMMENDATION, WISHLIST_RECOMMENDATION].include?(rec_typ)
  end
end
