//! Module root for the `licenses_files` anonymous import (test builds only).
//! `@embedFile` paths resolve relative to this file, and a module cannot embed
//! anything above its own root directory, so `build.zig` stages a directory
//! holding a copy of `licenses/` alongside copies of `build.zig.zon` and
//! `admin/package-lock.json`, and roots the import at the copy of this file.
//! That is why the two decls below name files that do not sit beside this one
//! in the repository.
//!
//! Everything here is embedded at compile time: `src/licenses_drift_test.zig`
//! reads no files and shells out to nothing.

/// The reviewed inventory `zig build dist` turns into THIRD-PARTY-NOTICES.
pub const inventory_zon = @embedFile("inventory.zon");

/// The head of the assembled THIRD-PARTY-NOTICES: the paragraph that states
/// which artifacts the file covers. It is data rather than a string literal in
/// `tools/dist_stage.zig` because the scope statement is part of the notice,
/// and the notice is reviewed here.
pub const preamble_txt = @embedFile("preamble.txt");

/// The recorded identity of the dependency sets the inventory must cover.
pub const dependency_identity_txt = @embedFile("dependency-identity.txt");

/// Repository root `build.zig.zon`, the identity of the Zig dependency set.
pub const build_zig_zon = @embedFile("build.zig.zon");

/// `admin/package-lock.json`, the identity of the npm closure.
pub const package_lock_json = @embedFile("package-lock.json");

/// `deploy/docker/Dockerfile`, the identity of the base image. The image is a
/// released artifact and the only third-party file it carries that the binary
/// does not — the CA bundle — comes out of that base, so a base bump is a
/// licence-inventory event like any dependency bump.
pub const dockerfile = @embedFile("Dockerfile");

pub const Text = struct {
    /// The name an inventory entry's `.file` field must use.
    name: []const u8,
    body: []const u8,
};

/// Every licence text under `licenses/`. An entry here that no inventory entry
/// names, or an inventory entry naming a file absent here, fails the guard.
pub const texts: []const Text = &.{
    .{ .name = "musl-copyright.txt", .body = @embedFile("musl-copyright.txt") },
    .{ .name = "zig-mit.txt", .body = @embedFile("zig-mit.txt") },
    .{ .name = "sqlite-public-domain.txt", .body = @embedFile("sqlite-public-domain.txt") },
    .{ .name = "mbedtls-apache-2.0.txt", .body = @embedFile("mbedtls-apache-2.0.txt") },
    .{ .name = "everest-apache-2.0.txt", .body = @embedFile("everest-apache-2.0.txt") },
    .{ .name = "p256-m-apache-2.0.txt", .body = @embedFile("p256-m-apache-2.0.txt") },
    .{ .name = "react-mit.txt", .body = @embedFile("react-mit.txt") },
    .{ .name = "tanstack-mit.txt", .body = @embedFile("tanstack-mit.txt") },
    .{ .name = "tanstack-store-mit.txt", .body = @embedFile("tanstack-store-mit.txt") },
    .{ .name = "react-aria-apache-2.0.txt", .body = @embedFile("react-aria-apache-2.0.txt") },
    .{ .name = "clsx-mit.txt", .body = @embedFile("clsx-mit.txt") },
    .{ .name = "stylex-mit.txt", .body = @embedFile("stylex-mit.txt") },
    .{ .name = "styleq-mit.txt", .body = @embedFile("styleq-mit.txt") },
    .{ .name = "visx-mit.txt", .body = @embedFile("visx-mit.txt") },
    .{ .name = "d3-isc.txt", .body = @embedFile("d3-isc.txt") },
    .{ .name = "classnames-mit.txt", .body = @embedFile("classnames-mit.txt") },
    .{ .name = "balanced-match-mit.txt", .body = @embedFile("balanced-match-mit.txt") },
    .{ .name = "math-expression-evaluator-mit.txt", .body = @embedFile("math-expression-evaluator-mit.txt") },
    .{ .name = "reduce-css-calc-mit.txt", .body = @embedFile("reduce-css-calc-mit.txt") },
    .{ .name = "reduce-function-call-mit.txt", .body = @embedFile("reduce-function-call-mit.txt") },
    .{ .name = "vite-mit.txt", .body = @embedFile("vite-mit.txt") },
    .{ .name = "rolldown-mit.txt", .body = @embedFile("rolldown-mit.txt") },
    .{ .name = "mozilla-ca-bundle-mpl-2.0.txt", .body = @embedFile("mozilla-ca-bundle-mpl-2.0.txt") },
};
