{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/helena-bio/json-schema/helena-bio-session-annotations-response-schema.json",
  "title": "SessionAnnotationsResponse",
  "description": "All annotations for a session, for internal consumer merging.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/helena-bio-internal-api-openapi.yml#/components/schemas/SessionAnnotationsResponse",
  "properties": {
    "session_id": {
      "type": "string",
      "format": "uuid",
      "title": "Session Id"
    },
    "annotations": {
      "items": {
        "$ref": "#/$defs/AnnotationRecord"
      },
      "type": "array",
      "title": "Annotations"
    },
    "total_count": {
      "type": "integer",
      "title": "Total Count",
      "description": "Number of annotated variants in this session."
    }
  },
  "type": "object",
  "required": [
    "session_id",
    "annotations",
    "total_count"
  ],
  "$defs": {
    "AnnotationRecord": {
      "properties": {
        "variant_idx": {
          "type": "integer",
          "title": "Variant Idx"
        },
        "is_user_flagged": {
          "type": "boolean",
          "title": "Is User Flagged",
          "default": false
        },
        "user_flag_comment": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "User Flag Comment"
        },
        "flagged_by": {
          "anyOf": [
            {
              "$ref": "#/$defs/UserAttribution"
            },
            {
              "type": "null"
            }
          ]
        },
        "acmg_override_class": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Acmg Override Class"
        },
        "acmg_class_original": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Acmg Class Original"
        },
        "override_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Override Reason"
        },
        "overridden_by": {
          "anyOf": [
            {
              "$ref": "#/$defs/UserAttribution"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "variant_idx"
      ],
      "title": "AnnotationRecord",
      "description": "A single variant annotation (flag, override, or both)."
    },
    "UserAttribution": {
      "properties": {
        "user_id": {
          "anyOf": [
            {
              "type": "string",
              "format": "uuid"
            },
            {
              "type": "null"
            }
          ],
          "title": "User Id",
          "description": "User UUID. May be None for historical records migrated from DuckDB where original user was not tracked."
        },
        "user_name": {
          "type": "string",
          "title": "User Name",
          "description": "Display name of the user. For historical records, may be 'system:historical-migration' or 'unknown-historical'."
        },
        "timestamp": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Timestamp",
          "description": "When the action occurred. None for historical records without precise timestamp."
        }
      },
      "type": "object",
      "required": [
        "user_name"
      ],
      "title": "UserAttribution",
      "description": "Identifies a user who performed an action, with optional timestamp.\n\nUsed in flag/override responses and annotation records. Both user_id\nand user_name are required — user_id for system references, user_name\nfor display. timestamp optional because some historical records\n(migrated from DuckDB) lack precise timestamps."
    }
  }
}