load("@rules_jvm_external//:defs.bzl", "artifact")
load("//common:defs.bzl", "copy_file")
load("//java:defs.bzl", "java_export", "java_library")
load("//java:version.bzl", "SE_VERSION")

java_export(
    name = "remote",
    hides = [
        "org.openqa.selenium.remote.internal",
    ],
    maven_coordinates = "org.seleniumhq.selenium:selenium-remote-driver:%s" % SE_VERSION,
    opens_to = [
        "org.seleniumhq.selenium.json",
    ],
    pom_template = "//java/src/org/openqa/selenium:template-pom",
    tags = [
        "release-artifact",
    ],
    uses = [
        "org.openqa.selenium.devtools.CdpInfo",
        "org.openqa.selenium.remote.AugmenterProvider",
        "org.openqa.selenium.remote.service.DriverService$Builder",
    ],
    visibility = ["//visibility:public"],
    exports = [
        ":api",
        "//java/src/org/openqa/selenium:core",
        "//java/src/org/openqa/selenium/bidi",
        "//java/src/org/openqa/selenium/bidi:augmenter",
        "//java/src/org/openqa/selenium/bidi/browsingcontext",
        "//java/src/org/openqa/selenium/bidi/log",
        "//java/src/org/openqa/selenium/bidi/module",
        "//java/src/org/openqa/selenium/bidi/network",
        "//java/src/org/openqa/selenium/bidi/script",
        "//java/src/org/openqa/selenium/bidi/storage",
        "//java/src/org/openqa/selenium/devtools",
        "//java/src/org/openqa/selenium/devtools:augmenter",
        "//java/src/org/openqa/selenium/os",
        "//java/src/org/openqa/selenium/remote/http",
        "//java/src/org/openqa/selenium/remote/locators",
        "//java/src/org/openqa/selenium/remote/tracing",
        "//java/src/org/openqa/selenium/remote/tracing/opentelemetry",
    ],
)

java_library(
    name = "api",
    srcs = glob(["**/*.java"]),
    resources = [
        ":bidi-mutation-listener",
        ":get-attribute",
        ":is-displayed",
    ],
    visibility = [
        "//java/src/org/openqa/selenium/bidi:__pkg__",
        "//java/src/org/openqa/selenium/bidi/browsingcontext:__pkg__",
        "//java/src/org/openqa/selenium/devtools:__pkg__",
    ],
    exports = [
    ],
    deps = [
        "//java/src/org/openqa/selenium:core",
        "//java/src/org/openqa/selenium/bidi",
        "//java/src/org/openqa/selenium/bidi/log",
        "//java/src/org/openqa/selenium/bidi/module",
        "//java/src/org/openqa/selenium/bidi/network",
        "//java/src/org/openqa/selenium/bidi/script",
        "//java/src/org/openqa/selenium/concurrent",
        "//java/src/org/openqa/selenium/devtools",
        "//java/src/org/openqa/selenium/json",
        "//java/src/org/openqa/selenium/manager",
        "//java/src/org/openqa/selenium/os",
        "//java/src/org/openqa/selenium/remote/http",
        "//java/src/org/openqa/selenium/remote/tracing",
        "//java/src/org/openqa/selenium/remote/tracing/opentelemetry",
        "//java/src/org/openqa/selenium/support/decorators",
        artifact("com.google.guava:guava"),
        artifact("net.bytebuddy:byte-buddy"),
    ],
)

copy_file(
    name = "get-attribute",
    src = "//javascript/webdriver/atoms:get-attribute.js",
    out = "getAttribute.js",
)

copy_file(
    name = "is-displayed",
    src = "//javascript/atoms/fragments:is-displayed.js",
    out = "isDisplayed.js",
)

copy_file(
    name = "bidi-mutation-listener",
    src = "//javascript/bidi-support:bidi-mutation-listener.js",
    out = "bidi-mutation-listener.js",
)
