class CompanyAdditionalChoice < ApplicationRecord
  include Base::CompanyAdditionalChoice

  belongs_to :field, class_name: 'CompanyAdditionalField', foreign_key: :CSID, 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
