load("//tools:copts.bzl", "COPTS")

cc_library(
    name = "games_manager",
    srcs = ["ShardokGamesManager.cpp"],
    hdrs = ["ShardokGamesManager.hpp"],
    copts = COPTS,
    data = [
        "//src/main/resources/net/eagle0/shardok/maps",
    ],
    visibility = ["//visibility:public"],
    deps = [
        ":server_configuration",
        "//src/main/cpp/net/eagle0/common:tsv_parser",
        "//src/main/cpp/net/eagle0/common:unit_conversions",
        "//src/main/cpp/net/eagle0/shardok/ai:shardok_ai_client",
        "//src/main/cpp/net/eagle0/shardok/controller",
        "//src/main/cpp/net/eagle0/shardok/library:engine",
        "//src/main/cpp/net/eagle0/shardok/library/settings:game_settings",
        "//src/main/cpp/net/eagle0/shardok/library/settings_loader",
        "//src/main/cpp/net/eagle0/shardok/util:battalion_type_registrar",
        "//src/main/cpp/net/eagle0/shardok/util:map_loader",
        "//src/main/protobuf/net/eagle0/common:tutorial_battle_config_cc_proto",
        "//src/main/protobuf/net/eagle0/common:victory_condition_cc_proto",
    ],
)

cc_library(
    name = "server_configuration",
    srcs = ["ServerConfiguration.cpp"],
    hdrs = ["ServerConfiguration.hpp"],
    copts = COPTS,
    visibility = ["//src/main/cpp/net/eagle0/shardok:__subpackages__"],
    deps = [
        "//src/main/cpp/net/eagle0/common:filesystem_utils",
    ],
)

cc_library(
    name = "token_auth",
    hdrs = ["TokenAuthInterceptor.hpp"],
    copts = COPTS,
    visibility = ["//src/main/cpp/net/eagle0/shardok:__subpackages__"],
    deps = [
        "//src/main/cpp/net/eagle0/common:protobuf_warning_suppression",
        "@grpc//:grpc++",
    ],
)

cc_library(
    name = "game_over_response_populator",
    srcs = ["GameOverResponsePopulator.cpp"],
    hdrs = ["GameOverResponsePopulator.hpp"],
    copts = COPTS,
    visibility = ["//visibility:public"],
    deps = [
        "//src/main/cpp/net/eagle0/shardok/library:shardok_c_types",
        "//src/main/cpp/net/eagle0/shardok/library:shardok_exception",
        "//src/main/flatbuffer/net/eagle0/shardok/storage:unit_cc_fbs",
        "//src/main/protobuf/net/eagle0/common:common_unit_cc_proto",
        "//src/main/protobuf/net/eagle0/common:shardok_internal_interface_cc_grpc",
        "//src/main/protobuf/net/eagle0/common:victory_condition_cc_proto",
        "//src/main/protobuf/net/eagle0/shardok/common:game_status_cc_proto",
        "//src/main/protobuf/net/eagle0/shardok/common:player_info_cc_proto",
        "//src/main/protobuf/net/eagle0/shardok/storage:action_result_cc_proto",
    ],
)

cc_library(
    name = "eagle_interface_grpc_server",
    srcs = ["EagleInterfaceGrpcServer.cpp"],
    hdrs = ["EagleInterfaceGrpcServer.hpp"],
    copts = COPTS,
    visibility = ["//src/main/cpp/net/eagle0/shardok:__subpackages__"],
    deps = [
        ":game_over_response_populator",
        ":games_manager",
        ":token_auth",
        "//src/main/cpp/net/eagle0/common:unit_conversions",
        "//src/main/protobuf/net/eagle0/common:shardok_internal_interface_cc_grpc",
        "//src/main/protobuf/net/eagle0/common:victory_condition_cc_proto",
        "@grpc//:grpc++",
    ],
)
