{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pageweave-dev/json-schema/pageweave-dev-submission-detail-schema.json",
  "title": "SubmissionDetail",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pageweave-dev-openapi.json#/components/schemas/SubmissionDetail",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "form_id",
    "form_version_id",
    "read",
    "spam_verdict",
    "spam_score",
    "spam_overridden",
    "email_verification_status",
    "data",
    "page_url",
    "spam_signals",
    "failure_details",
    "uploads",
    "deliveries",
    "confirmation_email",
    "created_at",
    "updated_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "form_id": {
      "type": "string",
      "format": "uuid"
    },
    "form_version_id": {
      "type": "string",
      "format": "uuid"
    },
    "read": {
      "type": "boolean"
    },
    "spam_verdict": {
      "type": "string",
      "enum": [
        "ham",
        "quarantined",
        "discarded",
        "incomplete"
      ]
    },
    "spam_score": {
      "type": "integer"
    },
    "spam_overridden": {
      "type": "boolean"
    },
    "email_verification_status": {
      "type": "string",
      "enum": [
        "not_required",
        "pending",
        "verified",
        "failed"
      ],
      "description": "Double opt-in state. Pending/failed `ham` rows are hidden from list\nand detail responses; quarantined/discarded rows remain visible.\n"
    },
    "data": {
      "type": "object",
      "additionalProperties": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ]
      }
    },
    "page_url": {
      "description": "URL of the page the form was submitted on. Null when it could\nnot be captured (older submissions, direct API posts, stripped\nreferrers).\n",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "maxLength": 2048
    },
    "spam_signals": {
      "type": [
        "object",
        "null"
      ]
    },
    "failure_details": {
      "type": [
        "object",
        "null"
      ]
    },
    "uploads": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SubmissionUpload"
      }
    },
    "deliveries": {
      "type": "array",
      "description": "One row per form recipient (at most 10). The full\n`recipient_email` is returned only to callers with\n`form.recipient.manage`; `recipient_email_masked` is always\npresent.\n",
      "items": {
        "$ref": "#/$defs/SubmissionDelivery"
      }
    },
    "confirmation_email": {
      "description": "The visitor-facing confirmation email. Null when none was\nattempted: the form has it off, the submission is spam, or no\nemail field resolved a recipient.\n",
      "oneOf": [
        {
          "$ref": "#/$defs/SubmissionConfirmationEmail"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "SubmissionConfirmationEmail": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "recipient_email",
        "locale",
        "sent_at",
        "delivered_at",
        "failure_class",
        "reason",
        "attempts_count"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "sending",
            "sent",
            "held",
            "delivered",
            "skipped",
            "failed"
          ]
        },
        "recipient_email": {
          "type": "string",
          "format": "email"
        },
        "locale": {
          "type": "string"
        },
        "sent_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "delivered_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "failure_class": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "hard_bounce",
            "soft_bounce",
            "provider_error",
            "internal_error",
            null
          ]
        },
        "reason": {
          "type": [
            "string",
            "null"
          ]
        },
        "attempts_count": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "SubmissionDelivery": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "recipient_id",
        "recipient_email",
        "recipient_email_masked",
        "status",
        "failure_class",
        "reason",
        "attempts_count",
        "notified_at",
        "held_at",
        "hold_expires_at",
        "next_attempt_at",
        "created_at",
        "updated_at"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "recipient_id": {
          "type": "string",
          "format": "uuid",
          "description": "The form recipient this delivery targets."
        },
        "recipient_email": {
          "type": [
            "string",
            "null"
          ],
          "format": "email",
          "description": "Null unless the caller has form.recipient.manage."
        },
        "recipient_email_masked": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "sending",
            "sent",
            "held",
            "delivered",
            "skipped",
            "failed",
            "expired"
          ],
          "description": "Delivery state, not inbox placement: `sent` means the provider\naccepted the message, `delivered` means the recipient's server did.\n"
        },
        "failure_class": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "hard_bounce",
            "soft_bounce",
            "provider_error",
            "internal_error",
            null
          ]
        },
        "reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "Internal reason code, never a provider message."
        },
        "attempts_count": {
          "type": "integer",
          "minimum": 0
        },
        "notified_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "held_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "hold_expires_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "next_attempt_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "SubmissionUpload": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "field_name",
        "filename",
        "content_type",
        "byte_size",
        "download_url"
      ],
      "properties": {
        "field_name": {
          "type": "string"
        },
        "filename": {
          "type": "string"
        },
        "content_type": {
          "type": "string"
        },
        "byte_size": {
          "type": "integer",
          "minimum": 0
        },
        "download_url": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}