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

if (!is_fuchsia) {
  source_set("bert_safety_op_resolver") {
    _configs = configs
    configs = []
    configs = [ "//third_party/tflite:tflite_shim_config" ] + _configs
    sources = [
      "bert_safety_op_resolver.cc",
      "bert_safety_op_resolver.h",
    ]

    deps = [
      "//components/optimization_guide/core/inference:op_resolver",
      "//third_party/tensorflow-text:shimed_bert_model_ops",
      "//third_party/tflite",
    ]
  }

  source_set("bert_safety_model") {
    _configs = configs
    configs = []
    configs = [ "//third_party/tflite:tflite_shim_config" ] + _configs
    sources = [
      "bert_safety_model.cc",
      "bert_safety_model.h",
    ]

    deps = [
      ":bert_safety_op_resolver",
      ":safety_util",
      "//base",
      "//components/translate/core/language_detection",
    ]

    public_deps = [
      "//mojo/public/cpp/bindings",
      "//services/on_device_model/public/mojom",
      "//third_party/tflite",
      "//third_party/tflite_support",
      "//third_party/tflite_support:tflite_support_proto",
    ]
  }

  source_set("safety_model_holder") {
    sources = [
      "safety_model_holder.cc",
      "safety_model_holder.h",
    ]

    deps = [
      ":bert_safety_model",
      "//base",
      "//mojo/public/cpp/bindings",
      "//services/on_device_model/public/mojom",
    ]

    defines = [ "IS_ON_DEVICE_MODEL_IMPL" ]
  }
}

source_set("safety_util") {
  sources = [
    "safety_util.cc",
    "safety_util.h",
  ]

  deps = [
    "//base",
    "//components/optimization_guide/core:features",
    "//components/translate/core/language_detection",
  ]
}
