{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/skribble/json-schema/skribble-create-signature-observer-request-schema.json",
  "title": "Signature Observer",
  "description": "Defines an observer target which can either be a USER or a GROUP.\n\n- For type USER, either email or user_id must be provided (but not both). When using email, a user will be automatically created if not present and returned.\n- For type GROUP, group_id must be provided and no user fields are allowed.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/skribble-signature-observer-api-openapi.yml#/components/schemas/CreateSignatureObserverRequest",
  "type": "object",
  "required": [
    "type"
  ],
  "properties": {
    "type": {
      "type": "string",
      "description": "Type of observer target.",
      "enum": [
        "USER",
        "GROUP"
      ]
    }
  },
  "oneOf": [
    {
      "title": "User Observer",
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "const": "USER"
        }
      },
      "oneOf": [
        {
          "title": "User by Email",
          "required": [
            "email"
          ],
          "properties": {
            "email": {
              "type": "string",
              "format": "email",
              "description": "Email address of the user."
            }
          }
        },
        {
          "title": "User by ID",
          "required": [
            "user_id"
          ],
          "properties": {
            "user_id": {
              "type": "string",
              "description": "Unique user identifier."
            }
          }
        }
      ]
    },
    {
      "title": "Group Observer",
      "type": "object",
      "required": [
        "type",
        "group_id"
      ],
      "properties": {
        "type": {
          "const": "GROUP"
        },
        "group_id": {
          "type": "string",
          "description": "Unique group identifier."
        }
      }
    }
  ]
}