class Lookup < ApplicationRecord
  
  has_many :accounts

  def available_types
    {'Employee Roles' => 'employee_roles',
      'Dining Facilities Status' => 'dining_facilities_status',
      'Menu Item Type' => 'menu_item_type',
      'Menu Item Attribute Type' => 'menu_item_attribute_type',
      'Order Type' => 'order_type',
      'Order Source' => 'order_source',
      'Order Status' => 'order_status',
      'Order Item Status' => 'order_item_status',
      'Sale Status' => 'sales_status',
      'Payment Status' => 'payment_status',
      'Payment Methods' => 'payment_methods',
      "Gateway Communication Type" => "gateway_communication_type"}
  end

  # def self.get_by_type( lookup_type)
  #   Lookup.select("value, name").where("lookup_type = ?", lookup_type ).order("name asc").map { |r| [r.name, r.value] }  
  # end

  def self.collection_of(type)
    Lookup.select("name, value").where("lookup_type" => type ).map { |l| [l.name, l.value] }

  end
end
