{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dialogbrain-com/json-schema/dialogbrain-com-draft-card-schema.json",
  "title": "DraftCard",
  "description": "Complete draft card with preview, evidence, and guard checks.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dialogbrain-com-agent-api-openapi.yml#/components/schemas/DraftCard",
  "properties": {
    "action_id": {
      "type": "string",
      "title": "Action Id"
    },
    "thread_id": {
      "type": "string",
      "title": "Thread Id"
    },
    "preview": {
      "$ref": "#/$defs/DraftPreview"
    },
    "evidence": {
      "items": {
        "$ref": "#/$defs/RAGEvidence"
      },
      "type": "array",
      "title": "Evidence"
    },
    "guard": {
      "$ref": "#/$defs/GuardCheck"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "metadata": {
      "additionalProperties": true,
      "type": "object",
      "title": "Metadata"
    }
  },
  "type": "object",
  "required": [
    "action_id",
    "thread_id",
    "preview",
    "guard"
  ],
  "$defs": {
    "DraftPreview": {
      "properties": {
        "title": {
          "type": "string",
          "title": "Title"
        },
        "content": {
          "type": "string",
          "title": "Content"
        },
        "recipients": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Recipients"
        },
        "evidence_used": {
          "type": "boolean",
          "title": "Evidence Used",
          "default": false
        },
        "evidence_count": {
          "type": "integer",
          "title": "Evidence Count",
          "default": 0
        }
      },
      "type": "object",
      "required": [
        "title",
        "content",
        "recipients"
      ],
      "title": "DraftPreview",
      "description": "Draft message preview."
    },
    "GuardCheck": {
      "properties": {
        "status": {
          "$ref": "#/$defs/GuardStatus"
        },
        "issues": {
          "items": {
            "$ref": "#/$defs/GuardIssue"
          },
          "type": "array",
          "title": "Issues"
        },
        "analysis": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Analysis"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "title": "Timestamp"
        }
      },
      "type": "object",
      "required": [
        "status"
      ],
      "title": "GuardCheck",
      "description": "Guard check result."
    },
    "GuardIssue": {
      "properties": {
        "type": {
          "type": "string",
          "title": "Type"
        },
        "severity": {
          "type": "string",
          "title": "Severity"
        },
        "description": {
          "type": "string",
          "title": "Description"
        },
        "suggestion": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Suggestion"
        }
      },
      "type": "object",
      "required": [
        "type",
        "severity",
        "description"
      ],
      "title": "GuardIssue",
      "description": "Individual guard issue detected."
    },
    "GuardStatus": {
      "type": "string",
      "enum": [
        "pass",
        "warning",
        "block"
      ],
      "title": "GuardStatus",
      "description": "Guard check status."
    },
    "RAGEvidence": {
      "properties": {
        "text": {
          "type": "string",
          "title": "Text"
        },
        "source_desc": {
          "type": "string",
          "title": "Source Desc"
        },
        "relevance": {
          "type": "number",
          "title": "Relevance"
        },
        "source_type": {
          "type": "string",
          "title": "Source Type"
        },
        "uri": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Uri"
        },
        "metadata": {
          "additionalProperties": true,
          "type": "object",
          "title": "Metadata"
        },
        "chunk_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Chunk Id"
        }
      },
      "type": "object",
      "required": [
        "text",
        "source_desc",
        "relevance",
        "source_type"
      ],
      "title": "RAGEvidence",
      "description": "RAG search evidence."
    }
  }
}