# == Schema Information
#
# Table name: hardware_parts
#
#  id            :integer          not null, primary key
#  name          :string(255)
#  part_number   :string(255)
#  internal_name :string(255)
#  created_at    :datetime
#  updated_at    :datetime
#  wifi_uplink   :boolean          default(FALSE)
#  usb           :boolean          default(FALSE)
#

class HardwarePart < ActiveRecord::Base
  has_many :router_inventories
  has_many :switch_configurations
  belongs_to :hardware_category

  scope :switch_hardware_parts, -> { where(hardware_category_id: HardwareCategory.where(name: 'switch').last.id) }

  def switch?
    self.hardware_category.try(:name) == 'switch'
  end
end
