{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/everpop-app/json-schema/everpop-app-publish-envelope-schema.json",
  "title": "PublishEnvelope",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/everpop-app-publish-api-openapi.yml#/components/schemas/PublishEnvelope",
  "type": "object",
  "properties": {
    "ok": {
      "const": true
    },
    "data": {
      "type": "object",
      "properties": {
        "clipId": {
          "type": "string"
        },
        "posts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PublishResult"
          },
          "description": "One result per requested destination that took the clip. Idempotent per (clip, destination): a clip already published there returns its existing post."
        }
      },
      "required": [
        "clipId",
        "posts"
      ]
    }
  },
  "required": [
    "ok",
    "data"
  ],
  "$defs": {
    "PublishResult": {
      "type": "object",
      "properties": {
        "destinationId": {
          "type": "string"
        },
        "platform": {
          "type": "string",
          "enum": [
            "TIKTOK",
            "INSTAGRAM_REELS",
            "YOUTUBE_SHORTS",
            "FACEBOOK_REELS",
            "THREADS"
          ]
        },
        "status": {
          "type": "string",
          "description": "This destination's post status after the call — one of the post statuses GET /api/v1/posts reports (e.g. PUBLISHING, QUEUED, FAILED) — or CONFLICT when the destination already has a publish of this clip with different reviewed choices (see errorCode). Follow later changes with GET /api/v1/posts."
        },
        "currentStatus": {
          "type": "string",
          "description": "When the call did not proceed because this destination already has a post for the clip: that post's status."
        },
        "errorCode": {
          "type": "string",
          "enum": [
            "PUBLISH_INTENT_CONFLICT",
            "META_PUBLISH_HISTORY_REVIEW_REQUIRED"
          ]
        },
        "errorMessage": {
          "type": "string",
          "description": "Customer-facing reason, when this destination did not proceed."
        }
      },
      "required": [
        "destinationId",
        "platform",
        "status"
      ]
    }
  }
}