{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/antwork-io/json-schema/antwork-io-media-created-schema.json",
  "title": "MediaCreated",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/antwork-io-media-api-openapi.yml#/components/schemas/MediaCreated",
  "allOf": [
    {
      "$ref": "#/$defs/Media"
    },
    {
      "type": "object",
      "properties": {
        "attached": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "With `attachToPostIds`: the posts it was added to."
        },
        "notAttached": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "postId": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "description": "With `attachToPostIds`: the posts it was not added to, and why (a published post)."
        }
      }
    }
  ],
  "$defs": {
    "Media": {
      "type": "object",
      "required": [
        "object",
        "id",
        "workspaceId",
        "url",
        "name",
        "type"
      ],
      "properties": {
        "object": {
          "const": "media"
        },
        "id": {
          "type": "string"
        },
        "workspaceId": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "description": "What `media` on a post takes."
        },
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "image",
            "video",
            "document"
          ]
        },
        "size": {
          "type": "integer"
        },
        "durationSec": {
          "type": [
            "number",
            "null"
          ]
        },
        "uploadedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    }
  }
}