// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_HEURISTIC_SOURCE_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_HEURISTIC_SOURCE_H_

#include <optional>
#include <string_view>

#include "components/autofill/core/browser/form_parsing/buildflags.h"
#include "components/autofill/core/browser/form_parsing/regex_patterns.h"

namespace autofill {

// The different ways to compute heuristic predictions.
// At field level, heuristic predictions are associated to a HeuristicSource,
// describing which mechanism computed them.
enum class HeuristicSource {
  kRegexes,
  kAutofillMachineLearning,
  kPasswordManagerMachineLearning,
  kMaxValue = kPasswordManagerMachineLearning
};

// The active heuristic sources depend on the build config and Finch configs.
HeuristicSource GetActiveHeuristicSource();

// Converts a `HeuristicSource` the corresponding `PatternFile`, in case the
// `source` is using regexes. Otherwise, nullopt is returned.
std::optional<PatternFile> HeuristicSourceToPatternFile(HeuristicSource source);

// Converts a `HeuristicSource` into a string used to record logs.
std::string_view HeuristicSourceToString(HeuristicSource source);

}  // namespace autofill

#endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_HEURISTIC_SOURCE_H_
