/* Page extension: preserves this page’s reviewed document-access scenario. */


static void cleanup_context(void) {
}

/* Page reference context for diagnostic and limit calls; no engine objects are needed. */
static maelys_datalog_diagnostic_t failed_diagnostic(void) {
    maelys_datalog_diagnostic_t diagnostic = MAELYS_DATALOG_DIAGNOSTIC_INIT;
    maelys_datalog_policy_t *policy = NULL;
    const char *source = "allow(User, Doc) :- owns(User, Doc).";
    maelys_datalog_status_t status = maelys_datalog_policy_load_inline(
        "missing-domain", "documents.main", source, strlen(source), &policy, &diagnostic);
    if (status == MAELYS_DATALOG_STATUS_OK) {
        check_status(maelys_datalog_policy_free(policy));
        fputs("Expected policy loading to fail\n", stderr);
        exit(EXIT_FAILURE);
    }
    return diagnostic;
}
int main(void) {
    if (atexit(cleanup_context) != 0) return EXIT_FAILURE;
    /* API_REFERENCE_EXAMPLE */
    cleanup_context();
    if (cleanup_failed) return EXIT_FAILURE;
    return EXIT_SUCCESS;
}
