# the validator class

class Validator
  def intialize()
  end

  # evasion class, hash {option name -> option value}
  def valid_evasion?(evasion, option_hash)
    return true
  end
  # hash {
  #   evasion class, hash {option name -> option value},
  # }
  def valid_combo?(configured_evasions)
    return true # ignore stage overlap
    # check for stage overlap
    evasions_by_basename = {}
    configured_evasions.each_key do |evasion|
      if not evasions_by_basename.has_key?(evasion.base_name)
        evasions_by_basename[evasion.base_name] = []
      end
      evasions_by_basename[evasion.base_name].push evasion
    end
    evasions_by_basename.each do |base_name, evasion_list|
      next if evasion_list.size == 1
      evasion_list.size.times do |i|
        ev1 = evasion_list[i]
        if ev1.instance_of?(Predator4Module::OriginalEvasion) # if one of them is the original evasion then there always is overlap
          return false
        end
        evasion_list.size.times do |j|
          next if not i > j
          ev2 = evasion_list[j]
          if ev1.parent.overlap?(ev1, ev2)
            return false # stage overlap found
          end
        end
      end
    end
    return true
  end
  def to_s
    return "Unimplemented"
  end
end
