class EmployeeAdditionalChoice < ApplicationRecord
  include Base::EmployeeAdditionalChoice

  belongs_to :field, class_name: 'EmployeeAdditionalField', foreign_key: :USID, inverse_of: :choices

  delegate :school, to: :field

  validates :name, presence: true, length: { maximum: 48 }, uniqueness: { scope: :field }
  validates :value, presence: true, length: { maximum: 16 }, uniqueness: { scope: :field }
  validates :order, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
end
