class AdjustmentType
  def self.validate(row, repo)
    reasons = []

    unless row[:adjustment_type]
      reasons << 'Adjustment type is required'
      return reasons
    end

    adjustment_type_id = get_adjustment_type_id(row[:adjustment_type], repo)

    reasons << 'Adjustment type is not supported by Abacus' unless adjustment_type_id

    reasons << "'Account Expense' is not an allowed adjustment type" if row[:adjustment_type] == 'Account Expense'

    reasons
  end

  def self.get_adjustment_type_id(adjustment_type, repo)
    repo.get_adjustment_type_id(adjustment_type)
  end
end
