// WIT interface for the `render_provisioning_report` WASM op.
//
// Skeleton — pins the host/guest contract the future `WasmCatalogBackend`
// will implement per ADR-030 mechanism #3. When the Phase B trigger fires
// (T3/T4/T5 per ADR-030), this interface becomes the surface the daemon's
// wasmtime host expects.

package ontoref:catalog@0.1.0;

interface op {
    /// Op input envelope — JSON-serialisable record passed from the host.
    record render-input {
        instance-id: string,
        format:      string,  // "markdown" | "json" | "html"
    }

    /// Op output envelope — the daemon signs this verbatim as the
    /// witness payload (after canonical re-encoding).
    record render-output {
        instance-id:  string,
        format:       string,
        body:         string,
        generated-at: string,   // RFC3339 timestamp produced by host clock
        bytes:        u32,
    }

    /// Op failure mode — surfaces to the daemon as
    /// OpError::ValidatorRejected | OpError::ExecutionFailed.
    variant render-error {
        instance-unknown(string),
        format-unsupported(string),
        rendering-failed(string),
    }

    /// Single entry point — name MUST match
    /// `body.export_name` in the catalog declaration.
    render: func(input: render-input) -> result<render-output, render-error>;
}

world catalog-op {
    export op;
}
