#
# Copyright (c) 2025 Intel Corporation
#
# 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.
#

load("@mediapipe//mediapipe/framework/port:build_config.bzl", "mediapipe_cc_proto_library", "mediapipe_proto_library")
load("//:common_settings.bzl", "ovms_cc_library")

ovms_cc_library(
    name = "graph_export",
    srcs = ["graph_export.cpp"],
    hdrs = ["graph_export.hpp"],
    deps =  [
        "@ovms//src:cpp_headers",
        "@ovms//src:libovmsstring_utils",
        "@ovms//src:libovmslogging",
        "@ovms//src:libovms_server_settings",
        "@ovms//src:libovms_module",
        "@ovms//src/filesystem:libovmsfilesystem",
        "@ovms//src/filesystem:libovmslocalfilesystem",
        "@ovms//src:libovms_systeminfo",
        "@com_github_tencent_rapidjson//:rapidjson",
        "@ovms//src:libovmsschema",
        "@ovms//src:libovms_version",
        "//src/port:rapidjson_stringbuffer",
        "//src/port:rapidjson_writer",
    ] + select({
            "//:not_disable_mediapipe": [
                "@mediapipe//mediapipe/framework/port:parse_text_proto",
                "@mediapipe//mediapipe/framework:calculator_graph",
                ],
            "//:disable_mediapipe": []
            }),
    visibility = ["//visibility:public"],
)

ovms_cc_library(
    name = "graph_cli_parser",
    srcs = ["graph_cli_parser.cpp"],
    hdrs = ["graph_cli_parser.hpp"],
    deps =  [
        "@ovms//src:cpp_headers",
        "@ovms//src:libovms_server_settings",
        "@ovms//src:ovms_exit_codes",
        "@ovms//src/llm:io_processing_parser_config_validation",
        "@com_github_jarro2783_cxxopts//:cxxopts",
    ],
    visibility = ["//visibility:public"],
)

ovms_cc_library(
    name = "rerank_graph_cli_parser",
    srcs = ["rerank_graph_cli_parser.cpp"],
    hdrs = ["rerank_graph_cli_parser.hpp"],
    deps =  [
        "@ovms//src/graph_export:graph_cli_parser",
        "@ovms//src:cpp_headers",
        "@ovms//src:libovms_server_settings",
        "@ovms//src:ovms_exit_codes",
        "@com_github_jarro2783_cxxopts//:cxxopts",
    ],
    visibility = ["//visibility:public"],
)

ovms_cc_library(
    name = "image_generation_graph_cli_parser",
    srcs = ["image_generation_graph_cli_parser.cpp"],
    hdrs = ["image_generation_graph_cli_parser.hpp"],
    deps =  [
        "@ovms//src/graph_export:graph_cli_parser",
        "@ovms//src:cpp_headers",
        "@ovms//src:libovms_server_settings",
        "@ovms//src:ovms_exit_codes",
        "@com_github_jarro2783_cxxopts//:cxxopts",
        "@com_github_tencent_rapidjson//:rapidjson",
        "//src/port:rapidjson_stringbuffer",
        "//src/port:rapidjson_writer",
    ],
    visibility = ["//visibility:public"],
)

ovms_cc_library(
    name = "embeddings_graph_cli_parser",
    srcs = ["embeddings_graph_cli_parser.cpp"],
    hdrs = ["embeddings_graph_cli_parser.hpp"],
    deps =  [
        "@ovms//src/graph_export:graph_cli_parser",
        "@ovms//src:cpp_headers",
        "@ovms//src:libovms_server_settings",
        "@ovms//src:ovms_exit_codes",
        "@com_github_jarro2783_cxxopts//:cxxopts",
    ],
    visibility = ["//visibility:public"],
)

ovms_cc_library(
    name = "t2s_graph_cli_parser",
    srcs = ["t2s_graph_cli_parser.cpp"],
    hdrs = ["t2s_graph_cli_parser.hpp"],
    deps =  [
        "@ovms//src/graph_export:graph_cli_parser",
        "@ovms//src:cpp_headers",
        "@ovms//src:libovms_server_settings",
        "@ovms//src:ovms_exit_codes",
        "@com_github_jarro2783_cxxopts//:cxxopts",
    ],
    visibility = ["//visibility:public"],
)

ovms_cc_library(
    name = "s2t_graph_cli_parser",
    srcs = ["s2t_graph_cli_parser.cpp"],
    hdrs = ["s2t_graph_cli_parser.hpp"],
    deps =  [
        "@ovms//src/graph_export:graph_cli_parser",
        "@ovms//src:cpp_headers",
        "@ovms//src:libovms_server_settings",
        "@ovms//src:ovms_exit_codes",
        "@com_github_jarro2783_cxxopts//:cxxopts",
    ],
    visibility = ["//visibility:public"],
)
