# Copyright (C) 2025 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build/ohos.gni")

config("user_auth_common_config") {
  include_dirs = [ "inc" ]
}

ohos_source_set("user_auth_common") {
  sanitize = {
    integer_overflow = true
    boundary_sanitize = true
    cfi = true
    cfi_cross_dso = true
    debug = false
  }
  branch_protector_ret = "pac_ret"
  include_dirs = [ "inc" ]

  remove_configs = [ "//build/config/compiler:no_exceptions" ]

  sources = [
    "src/config_parser.cpp",
    "src/modal_extension_callback.cpp",
    "src/user_auth_api_event_reporter.cpp",
    "src/user_auth_helper.cpp",
    "src/user_auth_modal_callback.cpp",
  ]

  external_deps = [
    "ability_base:want",
    "ability_runtime:ability_context_native",
    "ability_runtime:ability_manager",
    "ability_runtime:abilitykit_native",
    "ability_runtime:app_context",
    "ability_runtime:extensionkit_native",
    "ability_runtime:ui_extension",
    "ace_engine:ace_uicontent",
    "bounds_checking_function:libsec_shared",
    "hiappevent:hiappevent_innerapi",
    "hilog:libhilog",
    "node:node_header_notice",
    "window_manager:window_native_kit",
  ]

  deps = [ "../native/client:userauth_client" ]

  configs = [
    "../../common:iam_log_config",
    "../../common:iam_utils_config",
  ]

  public_configs = [ ":user_auth_common_config" ]

  subsystem_name = "useriam"
  part_name = "user_auth_framework"
}