class Nursing::VaccineRecord < ApplicationRecord
  audited

  include Base::Nursing::VaccineRecord

  enum exempt: { not_exempt: 0, exempt: 1, medical: 2, religious: 3, personal: 4 }

  belongs_to :vaccine, foreign_key: :SVID, inverse_of: :vaccine_records
  belongs_to :student, foreign_key: :StudentID, inverse_of: :nursing_vaccine_records
  delegate :school, to: :student

  validates :notes, length: { maximum: 64 }

  def missing_vaccination?
    not_exempt? && vaccine_date.nil?
  end
end
