load("@rules_cc//cc:defs.bzl", "cc_library")
load("//tools:copts.bzl", "COPTS")

cc_library(
    name = "flatbuffer_wrapper",
    srcs = ["FlatbufferWrapper.cpp"],
    hdrs = ["FlatbufferWrapper.hpp"],
    copts = COPTS,
    visibility = [
        "//src/main/cpp/net/eagle0/shardok:__subpackages__",
        "//src/test/cpp/net/eagle0/shardok/library:__subpackages__",
    ],
    deps = [
        "//src/main/cpp/net/eagle0/common:byte_hasher",
        "//src/main/cpp/net/eagle0/common:filesystem_utils",
        "@flatbuffers",
    ],
)

cc_library(
    name = "game_state_helpers",
    srcs = ["GameStateHelpers.cpp"],
    hdrs = ["GameStateHelpers.hpp"],
    copts = COPTS,
    visibility = [
        "//src/main/cpp/net/eagle0/shardok/ai:__pkg__",
        "//src/main/cpp/net/eagle0/shardok/ai_battle_simulator:__pkg__",
        "//src/main/cpp/net/eagle0/shardok/ai_performance_runner:__pkg__",
        "//src/main/cpp/net/eagle0/shardok/library:__subpackages__",
        "//src/test/cpp/net/eagle0/shardok:__subpackages__",
    ],
    deps = [
        ":hex_map_helpers",
        ":invalid_proto_exception",
        "//src/main/cpp/net/eagle0/shardok/library:game_state_w",
        "//src/main/cpp/net/eagle0/shardok/library:shardok_c_types",
        "//src/main/cpp/net/eagle0/shardok/library/settings:game_settings",
        "//src/main/flatbuffer/net/eagle0/shardok/storage:unit_cc_fbs",
        "//src/main/protobuf/net/eagle0/shardok/common:game_status_cc_proto",
        "//src/main/protobuf/net/eagle0/shardok/common:hex_map_cc_proto",
        "//src/main/protobuf/net/eagle0/shardok/common:player_info_cc_proto",
    ],
)

cc_library(
    name = "hex_map_helpers",
    srcs = ["HexMapHelpers.cpp"],
    hdrs = ["HexMapHelpers.hpp"],
    copts = COPTS,
    visibility = [
        "//src/main/cpp/net/eagle0/shardok:__subpackages__",
        "//src/test/cpp/net/eagle0/shardok:__subpackages__",
    ],
    deps = [
        ":flatbuffer_wrapper",
        ":invalid_proto_exception",
        ":terrain_helpers",
        "//src/main/cpp/net/eagle0/common:byte_hasher",
        "//src/main/cpp/net/eagle0/shardok/library:shardok_c_types",
        "//src/main/cpp/net/eagle0/shardok/library/map:hex_map_hasher",
        "//src/main/flatbuffer/net/eagle0/shardok/storage:hex_map_cc_fbs",
        "//src/main/protobuf/net/eagle0/shardok/common:hex_map_cc_proto",
    ],
)

cc_library(
    name = "invalid_proto_exception",
    srcs = ["InvalidProtoException.hpp"],
    copts = COPTS,
    visibility = ["__pkg__"],
)

cc_library(
    name = "terrain_helpers",
    srcs = ["TerrainHelpers.cpp"],
    hdrs = ["TerrainHelpers.hpp"],
    copts = COPTS,
    visibility = [
        "//src/main/cpp/net/eagle0/shardok/library:__subpackages__",
        "//src/test/cpp/net/eagle0/shardok/library/fb_helpers:__pkg__",
    ],
    deps = [
        ":tile_modifier_helpers",
        "//src/main/cpp/net/eagle0/shardok/library:shardok_c_types",
        "//src/main/flatbuffer/net/eagle0/shardok/storage:terrain_cc_fbs",
        "//src/main/protobuf/net/eagle0/shardok/common:terrain_cc_proto",
    ],
)

cc_library(
    name = "tile_modifier_helpers",
    srcs = ["TileModifierHelpers.cpp"],
    hdrs = ["TileModifierHelpers.hpp"],
    copts = COPTS,
    visibility = [
        "//src/main/cpp/net/eagle0/shardok/library:__subpackages__",
        "//src/test/cpp/net/eagle0/shardok/library/fb_helpers:__pkg__",
    ],
    deps = [
        "//src/main/cpp/net/eagle0/shardok/library:shardok_c_types",
        "//src/main/flatbuffer/net/eagle0/shardok/storage:tile_modifier_cc_fbs",
        "//src/main/protobuf/net/eagle0/shardok/common:tile_modifier_cc_proto",
    ],
)
