{
  "openapi": "3.1.0",
  "info": {
    "title": "Djinn Audit Trail",
    "description": "Journal d'audit immutable et conformité RGPD",
    "version": "0.1.0"
  },
  "paths": {
    "/health": {
      "get": {
        "summary": "Health",
        "description": "Health check endpoint.\n\nThe `relay` block is the signal that was missing since T1a: `enabled`\nreports whether a relay is configured at all (`{\"enabled\": false}` is a\nmode — tests, local dev — not a failure); when enabled, `running` and\n`stats` report the background task's own view of itself, and `pending`\nis the outbox depth (`audit_outbox` rows still `delivered_at IS NULL`) —\na relay that died with a depth that keeps growing is visible here,\nwhich is the entire point of this chantier.\n\nThe `anchor` block (`bucket`: the name only; `last_anchored_at`: newest\nanchor of any tenant, read from `audit_chain_anchors`) makes a missing cron\nvisible: an anchoring nobody schedules fails silently.",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events": {
      "post": {
        "summary": "Create Event",
        "description": "Record a single audit event.",
        "operationId": "create_event_v1_events_post",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuditEventCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEvent"
                }
              }
            }
          },
          "409": {
            "description": "Chain integrity conflict: the event cannot extend this tenant's chain."
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Query Events",
        "description": "Query audit events with filters.",
        "operationId": "query_events_v1_events_get",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          },
          {
            "name": "actor_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor Id"
            }
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Action"
            }
          },
          {
            "name": "resource_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Resource Type"
            }
          },
          {
            "name": "resource_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Resource Id"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "$ref": "#/components/schemas/AuditSeverity"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Severity"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AuditEvent"
                  },
                  "title": "Response Query Events V1 Events Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/batch": {
      "post": {
        "summary": "Create Events Batch",
        "description": "Record multiple audit events.",
        "operationId": "create_events_batch_v1_events_batch_post",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchCreateResponse"
                }
              }
            }
          },
          "409": {
            "description": "Chain integrity conflict: the event cannot extend this tenant's chain."
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/{event_id}": {
      "get": {
        "summary": "Get Event",
        "description": "Get a single audit event by ID, scoped to a tenant.",
        "operationId": "get_event_v1_events__event_id__get",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Event Id"
            }
          },
          {
            "name": "tenant_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEvent"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gdpr/export": {
      "post": {
        "summary": "Gdpr Export",
        "description": "Export all data for a subject (RGPD droit d'accès).",
        "operationId": "gdpr_export_v1_gdpr_export_post",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GDPRExportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GDPRExportResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gdpr/anonymize": {
      "post": {
        "summary": "Gdpr Anonymize",
        "description": "Anonymize a data subject (RGPD droit à l'oubli).",
        "operationId": "gdpr_anonymize_v1_gdpr_anonymize_post",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GDPRAnonymizeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnonymizeResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/stats": {
      "get": {
        "summary": "Stats",
        "description": "Get audit statistics for a tenant.",
        "operationId": "stats_v1_stats_get",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response Stats V1 Stats Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/proof/verify": {
      "get": {
        "summary": "Verify Proof",
        "description": "Verify the tenant's integrity chain, optionally over a `chain_seq` window.\n\nThe head, the rows and the count are read in one transaction, streamed by\npages of 1000 rows. ok only if the chain is intact and its last row is the\nhead (a deleted tail is caught). Rows written before migration 004 are outside\nthe chain and reported in `unchained_count`. A window proves the internal\nchaining of the window and its link to the stored hash of the row before it;\nonly a full verification (no `from_seq`/`to_seq`) proves the chain from\ngenesis: see `scope` and `prefix_verified`. A window is capped at 10000 rows\n(422) and an empty explicit window is not ok.",
        "operationId": "verify_proof_v1_proof_verify_get",
        "parameters": [
          {
            "name": "tenant_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Tenant Id"
            }
          },
          {
            "name": "from_seq",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "maximum": 9223372036854775807,
                  "minimum": 1
                },
                {
                  "type": "null"
                }
              ],
              "title": "From Seq"
            }
          },
          {
            "name": "to_seq",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "maximum": 9223372036854775807,
                  "minimum": 1
                },
                {
                  "type": "null"
                }
              ],
              "title": "To Seq"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChainReport"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/{event_id}/proof": {
      "get": {
        "summary": "Event Proof",
        "description": "Return one event's stored hash next to a fresh recomputation.\n\nThe row is read under the authenticated tenant's scope: an event of another\ntenant, an unknown id and a row outside the chain all answer 404 alike. A\n403 would confirm the id exists, enough to probe a competitor's volume.",
        "operationId": "event_proof_v1_events__event_id__proof_get",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Event Id"
            }
          },
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventProof"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/exports/compliance": {
      "post": {
        "summary": "Export Compliance",
        "description": "Build the proof dossier (Markdown) for one tenant over one period.\n\nThe chain verdict covers the WHOLE chain from genesis (scope \"full\"), never\nonly the period. The period is at most 366 days (422 otherwise). The dossier\nlists at most the 1000 most recent events of the period: beyond that it says\nso (\"dossier tronqué à 1000 événements : N au total sur la période\"), and\n`event_count`, `by_action` and `by_resource_type` still cover the whole period.\nCounts, list and verdict are read in one transaction (one instant). The\nfull verification reads the tenant's whole chain on every call: O(N) in its\nrows (rate limiting is Kong's job). It is an integrity finding, not a legal\ncompliance attestation.",
        "operationId": "export_compliance_v1_exports_compliance_post",
        "parameters": [
          {
            "name": "X-API-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ComplianceExportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ComplianceExportResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AnonymizeResponse": {
        "properties": {
          "anonymized_count": {
            "type": "integer",
            "title": "Anonymized Count"
          },
          "subject_id": {
            "type": "string",
            "title": "Subject Id"
          }
        },
        "type": "object",
        "required": [
          "anonymized_count",
          "subject_id"
        ],
        "title": "AnonymizeResponse",
        "description": "Réponse d'anonymisation."
      },
      "AuditEvent": {
        "properties": {
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "actor_id": {
            "type": "string",
            "title": "Actor Id",
            "description": "ID de l'auteur de l'action"
          },
          "actor_type": {
            "type": "string",
            "title": "Actor Type",
            "description": "user | system | api_key",
            "default": "user"
          },
          "action": {
            "type": "string",
            "title": "Action",
            "description": "create | read | update | delete | export | login | ..."
          },
          "resource_type": {
            "type": "string",
            "title": "Resource Type",
            "description": "invoice | contract | user | ..."
          },
          "resource_id": {
            "type": "string",
            "title": "Resource Id",
            "description": "ID de la ressource concernée"
          },
          "changes": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Changes",
            "description": "Changements : {field: {old: x, new: y}}"
          },
          "metadata": {
            "additionalProperties": true,
            "type": "object",
            "title": "Metadata",
            "description": "IP, user-agent, request_id, etc."
          },
          "severity": {
            "$ref": "#/components/schemas/AuditSeverity",
            "default": "info"
          },
          "id": {
            "type": "string",
            "title": "Id"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          },
          "anonymized": {
            "type": "boolean",
            "title": "Anonymized",
            "default": false
          },
          "chain_seq": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Chain Seq",
            "description": "Position dans la chaîne d'intégrité du tenant"
          },
          "prev_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prev Hash",
            "description": "Haché de l'événement précédent"
          },
          "event_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Event Hash",
            "description": "Haché de cet événement"
          }
        },
        "type": "object",
        "required": [
          "tenant_id",
          "actor_id",
          "action",
          "resource_type",
          "resource_id",
          "id",
          "timestamp"
        ],
        "title": "AuditEvent",
        "description": "Événement d'audit complet avec ID et timestamp."
      },
      "AuditEventCreate": {
        "properties": {
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "actor_id": {
            "type": "string",
            "title": "Actor Id",
            "description": "ID de l'auteur de l'action"
          },
          "actor_type": {
            "type": "string",
            "title": "Actor Type",
            "description": "user | system | api_key",
            "default": "user"
          },
          "action": {
            "type": "string",
            "title": "Action",
            "description": "create | read | update | delete | export | login | ..."
          },
          "resource_type": {
            "type": "string",
            "title": "Resource Type",
            "description": "invoice | contract | user | ..."
          },
          "resource_id": {
            "type": "string",
            "title": "Resource Id",
            "description": "ID de la ressource concernée"
          },
          "changes": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Changes",
            "description": "Changements : {field: {old: x, new: y}}"
          },
          "metadata": {
            "additionalProperties": true,
            "type": "object",
            "title": "Metadata",
            "description": "IP, user-agent, request_id, etc."
          },
          "severity": {
            "$ref": "#/components/schemas/AuditSeverity",
            "default": "info"
          }
        },
        "type": "object",
        "required": [
          "tenant_id",
          "actor_id",
          "action",
          "resource_type",
          "resource_id"
        ],
        "title": "AuditEventCreate",
        "description": "Requête de création d'un événement d'audit."
      },
      "AuditSeverity": {
        "type": "string",
        "enum": [
          "info",
          "warning",
          "critical"
        ],
        "title": "AuditSeverity",
        "description": "Niveau de sévérité d'un événement."
      },
      "BatchCreateRequest": {
        "properties": {
          "events": {
            "items": {
              "$ref": "#/components/schemas/AuditEventCreate"
            },
            "type": "array",
            "minItems": 1,
            "title": "Events"
          }
        },
        "type": "object",
        "required": [
          "events"
        ],
        "title": "BatchCreateRequest",
        "description": "Requête de création d'événements en batch."
      },
      "BatchCreateResponse": {
        "properties": {
          "created": {
            "type": "integer",
            "title": "Created"
          },
          "events": {
            "items": {
              "$ref": "#/components/schemas/AuditEvent"
            },
            "type": "array",
            "title": "Events"
          }
        },
        "type": "object",
        "required": [
          "created",
          "events"
        ],
        "title": "BatchCreateResponse",
        "description": "Réponse de création en batch."
      },
      "ChainReport": {
        "properties": {
          "ok": {
            "type": "boolean",
            "title": "Ok"
          },
          "checked": {
            "type": "integer",
            "title": "Checked"
          },
          "first_broken_seq": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "First Broken Seq"
          },
          "first_broken_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "First Broken Id"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "scope": {
            "type": "string",
            "enum": [
              "full",
              "window"
            ],
            "title": "Scope",
            "default": "full"
          },
          "prefix_verified": {
            "type": "boolean",
            "title": "Prefix Verified",
            "default": true
          },
          "unchained_count": {
            "type": "integer",
            "title": "Unchained Count",
            "default": 0
          },
          "head_seq": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Head Seq"
          },
          "head_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Head Hash"
          }
        },
        "type": "object",
        "required": [
          "ok",
          "checked"
        ],
        "title": "ChainReport",
        "description": "Verdict, scope and the tenant's rows outside the chain (written before 004).\n\n`scope` is \"full\" when the whole chain from genesis to the head was verified,\n\"window\" otherwise. A window proves its own internal chaining and its link\nto the STORED hash of the row before it; it does not re-verify the prefix\n(`prefix_verified` is false) nor, if it stops before the head, the tail.\nOnly a full verification proves the chain from genesis."
      },
      "ComplianceExportRequest": {
        "properties": {
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "period_start": {
            "type": "string",
            "format": "date-time",
            "title": "Period Start"
          },
          "period_end": {
            "type": "string",
            "format": "date-time",
            "title": "Period End"
          }
        },
        "type": "object",
        "required": [
          "tenant_id",
          "period_start",
          "period_end"
        ],
        "title": "ComplianceExportRequest",
        "description": "Requête de dossier de preuve : tenant et période bornée (UTC, fuseau explicite)."
      },
      "ComplianceExportResponse": {
        "properties": {
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "period_start": {
            "type": "string",
            "format": "date-time",
            "title": "Period Start"
          },
          "period_end": {
            "type": "string",
            "format": "date-time",
            "title": "Period End"
          },
          "generated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Generated At"
          },
          "event_count": {
            "type": "integer",
            "title": "Event Count"
          },
          "listed_count": {
            "type": "integer",
            "title": "Listed Count"
          },
          "truncated": {
            "type": "boolean",
            "title": "Truncated"
          },
          "chain": {
            "$ref": "#/components/schemas/ChainReport"
          },
          "by_action": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object",
            "title": "By Action"
          },
          "by_resource_type": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object",
            "title": "By Resource Type"
          },
          "markdown": {
            "type": "string",
            "title": "Markdown"
          }
        },
        "type": "object",
        "required": [
          "tenant_id",
          "period_start",
          "period_end",
          "generated_at",
          "event_count",
          "listed_count",
          "truncated",
          "chain",
          "by_action",
          "by_resource_type",
          "markdown"
        ],
        "title": "ComplianceExportResponse",
        "description": "Dossier de preuve d'un tenant pour une période.\n\n`chain` porte sur la chaîne ENTIÈRE (scope \"full\"), jamais sur la seule\npériode. `event_count` est le total sur la période ; `markdown` ne liste que\nles 1000 événements les plus récents (`truncated`)."
      },
      "EventProof": {
        "properties": {
          "event_id": {
            "type": "string",
            "title": "Event Id"
          },
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "chain_seq": {
            "type": "integer",
            "title": "Chain Seq"
          },
          "prev_hash": {
            "type": "string",
            "title": "Prev Hash"
          },
          "event_hash": {
            "type": "string",
            "title": "Event Hash"
          },
          "recomputed_hash": {
            "type": "string",
            "title": "Recomputed Hash"
          },
          "ok": {
            "type": "boolean",
            "title": "Ok"
          }
        },
        "type": "object",
        "required": [
          "event_id",
          "tenant_id",
          "chain_seq",
          "prev_hash",
          "event_hash",
          "recomputed_hash",
          "ok"
        ],
        "title": "EventProof",
        "description": "Proof of one event: its stored hash next to a fresh recomputation.\n\n`ok` proves this row alone (recomputed hash equals the stored one). It does\nnot prove the link to the previous row nor the chain: use `/v1/proof/verify`."
      },
      "GDPRAnonymizeRequest": {
        "properties": {
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "subject_id": {
            "type": "string",
            "title": "Subject Id",
            "description": "ID de la personne à anonymiser"
          },
          "subject_type": {
            "type": "string",
            "enum": [
              "actor_id",
              "resource_id"
            ],
            "title": "Subject Type",
            "description": "Champ à anonymiser : actor_id | resource_id",
            "default": "actor_id"
          },
          "replacement": {
            "type": "string",
            "title": "Replacement",
            "description": "Valeur de remplacement",
            "default": "[ANONYMIZED]"
          }
        },
        "type": "object",
        "required": [
          "tenant_id",
          "subject_id"
        ],
        "title": "GDPRAnonymizeRequest",
        "description": "Requête d'anonymisation des données personnelles."
      },
      "GDPRExportRequest": {
        "properties": {
          "tenant_id": {
            "type": "string",
            "title": "Tenant Id"
          },
          "subject_id": {
            "type": "string",
            "title": "Subject Id",
            "description": "ID de la personne concernee"
          },
          "subject_type": {
            "type": "string",
            "enum": [
              "actor_id",
              "resource_id"
            ],
            "title": "Subject Type",
            "description": "Champ a chercher : actor_id | resource_id",
            "default": "actor_id"
          }
        },
        "type": "object",
        "required": [
          "tenant_id",
          "subject_id"
        ],
        "title": "GDPRExportRequest",
        "description": "Requête d'export des données personnelles (droit d'accès RGPD)."
      },
      "GDPRExportResponse": {
        "properties": {
          "subject_id": {
            "type": "string",
            "title": "Subject Id"
          },
          "event_count": {
            "type": "integer",
            "title": "Event Count"
          },
          "events": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Events"
          }
        },
        "type": "object",
        "required": [
          "subject_id",
          "event_count",
          "events"
        ],
        "title": "GDPRExportResponse",
        "description": "Réponse d'export RGPD."
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "HealthResponse": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status",
            "default": "ok"
          },
          "service": {
            "type": "string",
            "title": "Service",
            "default": "audit-trail"
          },
          "version": {
            "type": "string",
            "title": "Version",
            "default": "0.1.0"
          },
          "relay": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Relay"
          },
          "anchor": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Anchor"
          }
        },
        "type": "object",
        "title": "HealthResponse",
        "description": "Response for health check."
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  }
}
