{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/helena-bio/json-schema/helena-bio-flag-variant-response-schema.json",
  "title": "FlagVariantResponse",
  "description": "Response after flagging or unflagging a variant.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/helena-bio-flagging-api-openapi.yml#/components/schemas/FlagVariantResponse",
  "properties": {
    "variant_idx": {
      "type": "integer",
      "title": "Variant Idx"
    },
    "gene_symbol": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Gene Symbol"
    },
    "is_user_flagged": {
      "type": "boolean",
      "title": "Is User Flagged"
    },
    "email_sent": {
      "type": "boolean",
      "title": "Email Sent"
    },
    "message": {
      "type": "string",
      "title": "Message"
    },
    "flagged_by": {
      "anyOf": [
        {
          "$ref": "#/$defs/UserAttribution"
        },
        {
          "type": "null"
        }
      ],
      "description": "User who set the flag. None on unflag responses."
    }
  },
  "type": "object",
  "required": [
    "variant_idx",
    "is_user_flagged",
    "email_sent",
    "message"
  ],
  "$defs": {
    "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."
    }
  }
}