"""Convenience macros for Wails rules."""

load(":private/generate_bindings.bzl", "wails_generate_bindings")
load(":private/run.bzl", "wails_run")

def wails_app(name, binary, build_assets, bindings = None, icon = None, visibility = None, tags = None):
    wails_run(
        name = name + "_run",
        binary = binary,
        build_assets = build_assets,
        icon = icon,
        tags = tags,
        visibility = visibility,
    )

    if bindings:
        wails_generate_bindings(
            name = name + "_bindings",
            out_dir = bindings["out_dir"],
            package_dir = bindings.get("package_dir", "."),
            clean = bindings.get("clean", True),
            ts = bindings.get("ts", True),
            extra_args = bindings.get("extra_args", []),
            tags = tags,
            visibility = visibility,
        )

