load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_go_library")
load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")

FILE_NAMES = (
    "error_response",
    "submit_data_scouting",
    "submit_data_scouting_response",
    "request_all_matches",
    "request_all_matches_response",
    "request_matches_for_team",
    "request_matches_for_team_response",
    "request_data_scouting",
    "request_data_scouting_response",
    "refresh_match_list",
    "refresh_match_list_response",
    "submit_notes",
    "submit_notes_response",
    "request_notes_for_team",
    "request_notes_for_team_response",
    "request_shift_schedule",
    "request_shift_schedule_response",
    "submit_shift_schedule",
    "submit_shift_schedule_response",
)

filegroup(
    name = "fbs_files",
    srcs = ["%s.fbs" % name for name in FILE_NAMES],
    visibility = ["//visibility:public"],
)

[(
    flatbuffer_go_library(
        name = name + "_go_fbs",
        srcs = [name + ".fbs"],
        importpath = "github.com/frc971/971-Robot-Code/scouting/webserver/requests/messages/" + name,
        target_compatible_with = ["@platforms//cpu:x86_64"],
        visibility = ["//visibility:public"],
    ),
    flatbuffer_ts_library(
        name = name + "_ts_fbs",
        srcs = [name + ".fbs"],
        target_compatible_with = ["@platforms//cpu:x86_64"],
        visibility = ["//visibility:public"],
    ),
) for name in FILE_NAMES]
