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

cc_library(
    name = "game_state_w",
    srcs = ["GameStateW.cpp"],
    hdrs = ["GameStateW.hpp"],
    copts = COPTS,
    visibility = ["//visibility:public"],
    deps = [
        ":shardok_c_types",
        "//src/main/cpp/net/eagle0/shardok/library/fb_helpers:flatbuffer_wrapper",
        "//src/main/flatbuffer/net/eagle0/shardok/storage:game_state_cc_fbs",
        "//src/main/flatbuffer/net/eagle0/shardok/storage:unit_cc_fbs",
    ],
)

cc_library(
    name = "engine",
    srcs = ["ShardokEngine.cpp"],
    hdrs = ["ShardokEngine.hpp"],
    copts = COPTS,
    visibility = ["//visibility:public"],
    deps = [
        ":game_state_w",
        ":unit_placement_info",
        "//src/main/cpp/net/eagle0/shardok/library/actions:perform_undead_commands_action",
        "//src/main/cpp/net/eagle0/shardok/library/actions:update_game_status_action",
        "//src/main/cpp/net/eagle0/shardok/library/actions:update_opponent_knowledge_action",
        "//src/main/cpp/net/eagle0/shardok/library/fb_helpers:game_state_helpers",
        "//src/main/cpp/net/eagle0/shardok/library/tutorial:tutorial_battle_controller",
        "//src/main/cpp/net/eagle0/shardok/library/util:game_state_validator",
        "//src/main/cpp/net/eagle0/shardok/library/view_filters:action_result_filter",
        "//src/main/cpp/net/eagle0/shardok/library/view_filters:game_state_filter",
        "//src/main/protobuf/net/eagle0/shardok/storage:action_with_resulting_state_cc_proto",
    ],
)

cc_library(
    name = "action_cost",
    srcs = [],
    hdrs = ["ActionCost.hpp"],
    copts = COPTS,
    visibility = ["//visibility:public"],
    deps = [],
)

cc_library(
    name = "available_commands_factory",
    srcs = ["AvailableCommandsFactory.cpp"],
    hdrs = ["AvailableCommandsFactory.hpp"],
    copts = COPTS,
    visibility = ["//src/main/cpp/net/eagle0/shardok/library:__subpackages__"],
    deps = [
        ":shardok_c_types",
        ":shardok_command",
        "//src/main/cpp/net/eagle0/shardok/library/action_factories:player_setup_command_factory",
        "//src/main/cpp/net/eagle0/shardok/library/actions:end_player_setup_command",
        "//src/main/cpp/net/eagle0/shardok/library/actions:new_round_action",
        "//src/main/cpp/net/eagle0/shardok/library/command_factories:command_factories_list",
        "//src/main/cpp/net/eagle0/shardok/library/commands:end_turn_command",
        "//src/main/cpp/net/eagle0/shardok/library/map:coordinates",
        "//src/main/cpp/net/eagle0/shardok/library/settings:game_settings",
        "//src/main/cpp/net/eagle0/shardok/library/unit",
        "//src/main/cpp/net/eagle0/shardok/library/util:hex_map_utils",
        "//src/main/cpp/net/eagle0/shardok/library/util:zone_of_control_calculator",
        "//src/main/cpp/net/eagle0/shardok/library/view_filters:game_state_filter",
        "//src/main/cpp/net/eagle0/shardok/library/view_filters:game_state_guesser",
        "//src/main/protobuf/net/eagle0/shardok/api:action_result_view_cc_proto",
        "//src/main/protobuf/net/eagle0/shardok/api:game_state_view_cc_proto",
    ],
)

cc_library(
    name = "battalion_type",
    srcs = ["BattalionType.cpp"],
    hdrs = ["BattalionType.hpp"],
    copts = COPTS,
    visibility = ["//visibility:public"],
    deps = [
        ":action_cost",
        ":combat_damage",
        ":shardok_c_types",
        ":shardok_exception",
        "//src/main/cpp/net/eagle0/common:map_utils",
        "//src/main/cpp/net/eagle0/shardok/library:percentile_roll_odds",
        "//src/main/cpp/net/eagle0/shardok/library/map:terrain",
        "//src/main/flatbuffer/net/eagle0/shardok/storage:battalion_type_cc_fbs",
        "//src/main/flatbuffer/net/eagle0/shardok/storage:terrain_cc_fbs",
    ],
)

cc_library(
    name = "combat_damage",
    srcs = [],
    hdrs = ["CombatDamage.hpp"],
    copts = COPTS,
    visibility = ["//visibility:public"],
    deps = [],
)

cc_library(
    name = "fire_utils",
    srcs = ["FireUtils.cpp"],
    hdrs = ["FireUtils.hpp"],
    copts = COPTS,
    visibility = ["//src/main/cpp/net/eagle0/shardok/library:__subpackages__"],
    deps = [
        ":combat_damage",
        ":percentile_roll_odds",
        "//src/main/cpp/net/eagle0/shardok/library/map:tile_modifier",
        "//src/main/cpp/net/eagle0/shardok/library/settings:game_settings",
        "//src/main/flatbuffer/net/eagle0/shardok/storage:weather_cc_fbs",
        "//src/main/protobuf/net/eagle0/shardok/common:terrain_cc_proto",
    ],
)

cc_library(
    name = "percentile_roll_odds",
    srcs = ["PercentileRollOdds.cpp"],
    hdrs = ["PercentileRollOdds.hpp"],
    copts = COPTS,
    visibility = ["//visibility:public"],
    deps = [
        "//src/main/cpp/net/eagle0/common:random_generator",
        "//src/main/protobuf/net/eagle0/shardok/storage:odds_cc_proto",
    ],
)

cc_library(
    name = "shardok_action",
    srcs = ["ShardokAction.cpp"],
    hdrs = ["ShardokAction.hpp"],
    copts = COPTS,
    visibility = ["//src/main/cpp/net/eagle0/shardok/library:__subpackages__"],
    deps = [
        ":game_state_w",
        ":shardok_exception",
        "//src/main/cpp/net/eagle0/common:random_generator",
        "//src/main/protobuf/net/eagle0/shardok/storage:action_result_cc_proto",
    ],
)

cc_library(
    name = "shardok_c_types",
    hdrs = ["ShardokCTypes.h"],
    copts = COPTS,
    visibility = ["//visibility:public"],
)

cc_library(
    name = "shardok_command",
    srcs = [],
    hdrs = ["ShardokCommand.hpp"],
    copts = COPTS,
    visibility = ["//src/main/cpp/net/eagle0/shardok/library:__subpackages__"],
    deps = [
        ":shardok_action",
        ":shardok_c_types",
        "//src/main/protobuf/net/eagle0/shardok/api:command_descriptor_cc_proto",
        "//src/main/protobuf/net/eagle0/shardok/common:command_type_cc_proto",
    ],
)

cc_library(
    name = "shardok_exception",
    hdrs = ["ShardokException.hpp"],
    copts = COPTS,
    visibility = ["//visibility:public"],
)

cc_library(
    name = "unit_placement_info",
    hdrs = ["UnitPlacementInfo.hpp"],
    copts = COPTS,
    visibility = ["//src/main/cpp/net/eagle0/shardok:__subpackages__"],
    deps = [
        ":shardok_c_types",
    ],
)
