{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/preflight-social/json-schema/preflight-social-post-schema.json",
  "title": "Post",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/preflight-social-openapi.json#/components/schemas/Post",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "scheduled",
        "publishing",
        "done",
        "canceled"
      ]
    },
    "content": {
      "type": "string"
    },
    "linkUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "mediaIds": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uuid"
      }
    },
    "altTexts": {
      "type": "array",
      "items": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "scheduledAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "approvalState": {
      "type": [
        "string",
        "null"
      ],
      "description": "pending, approved or changes when a client approval link exists."
    },
    "repeat": {
      "type": [
        "object",
        "null"
      ],
      "description": "Null unless it repeats: everyDays, times, index (which time this is, from 0), variants (the wordings after this post's own, in order) and seriesId (the first post of the series)."
    },
    "tags": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Tag"
      }
    },
    "openNotes": {
      "type": "integer",
      "description": "Threads in the post's notes nobody has resolved."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "targets": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Target"
      }
    }
  },
  "$defs": {
    "Platform": {
      "type": "string",
      "enum": [
        "youtube",
        "tiktok",
        "instagram",
        "facebook",
        "threads",
        "twitter",
        "linkedin",
        "pinterest",
        "bluesky",
        "mastodon",
        "telegram",
        "discord",
        "tumblr"
      ],
      "description": "A network's name. twitter (X) is text-only and not offered to new accounts."
    },
    "Tag": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string",
          "pattern": "^#[0-9a-fA-F]{6}$"
        },
        "posts": {
          "type": "integer",
          "description": "How many posts carry it. Only in the list."
        }
      }
    },
    "Target": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "platform": {
          "$ref": "#/$defs/Platform"
        },
        "accountId": {
          "type": "string",
          "format": "uuid"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "publishing",
            "published",
            "failed",
            "skipped"
          ]
        },
        "remoteId": {
          "type": [
            "string",
            "null"
          ]
        },
        "remoteUrl": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        },
        "publishedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "error": {
          "type": [
            "string",
            "null"
          ]
        },
        "errorCode": {
          "type": [
            "string",
            "null"
          ]
        },
        "errorPermanent": {
          "type": "boolean",
          "description": "Retrying cannot succeed without changing something."
        },
        "attempts": {
          "type": "integer"
        },
        "nextAttemptAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "canEditRemote": {
          "type": "boolean"
        },
        "canDeleteRemote": {
          "type": "boolean"
        },
        "options": {
          "type": "object",
          "additionalProperties": true
        },
        "boostState": {
          "type": [
            "object",
            "null"
          ],
          "description": "Where options.boost stands: checkedAt and likes as last read; doneAt once it ran, with replyId and reposted, or expired when the window passed first."
        },
        "metrics": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": true,
          "description": "The latest figures, with fetchedAt."
        }
      }
    }
  }
}