class Nursing::VaccineConfig < ApplicationRecord
  include Base::Nursing::VaccineConfig

  audited

  associations_for legacy: true do |a|
    a.belongs_to :school
  end

  belongs_to :vaccine, class_name: 'Nursing::Vaccine', foreign_key: 'SVID',
    inverse_of: :vaccine_configs

  scope :ordered, -> { joins(:vaccine).order('StudentVaccines.Vaccine ASC') }
  scope :by_required, -> { where.not(grade: 99) }
end
