{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postnext-io/json-schema/postnext-io-post-group-schema.json",
  "title": "PostGroup",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/postnext-io-openapi.json#/components/schemas/PostGroup",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Post group uuid."
    },
    "_id": {
      "type": "string",
      "description": "Mongo ObjectId."
    },
    "userId": {
      "type": "string"
    },
    "teamId": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "imageUrl": {
      "type": "string",
      "format": "uri"
    },
    "providers": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/ProviderResponse"
      }
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "scheduledTime": {
      "type": "string",
      "format": "date-time"
    },
    "status": {
      "$ref": "#/$defs/PostStatus"
    },
    "assigneeId": {
      "type": "string"
    },
    "watchers": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "LegacyPostContent": {
      "type": "object",
      "description": "Single-post content (an object).",
      "properties": {
        "text": {
          "type": "string"
        },
        "mediaUrls": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "mediaType": {
          "type": "string",
          "enum": [
            "IMAGE",
            "VIDEO",
            "GIF",
            "CAROUSEL"
          ]
        },
        "hashtags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "assetIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "instagramPostType": {
          "type": "string",
          "enum": [
            "feed",
            "post",
            "story",
            "reel"
          ]
        }
      }
    },
    "MediaItem": {
      "type": "object",
      "required": [
        "url",
        "type"
      ],
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "type": {
          "type": "string",
          "enum": [
            "IMAGE",
            "VIDEO",
            "GIF"
          ]
        },
        "assetId": {
          "type": "string"
        },
        "thumbnail": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "PostContent": {
      "description": "Either a single LegacyPostContent object, or an array of ThreadPost for a\nmulti-part thread (twitter/threads).\n",
      "oneOf": [
        {
          "$ref": "#/$defs/LegacyPostContent"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ThreadPost"
          }
        }
      ]
    },
    "PostStatus": {
      "type": "string",
      "enum": [
        "DRAFT",
        "SCHEDULED",
        "PUBLISHING",
        "PUBLISHED",
        "FAILED",
        "APPROVAL"
      ]
    },
    "ProviderResponse": {
      "type": "object",
      "properties": {
        "providerId": {
          "type": "string"
        },
        "channelName": {
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/PostContent"
        },
        "firstComment": {
          "type": "string"
        },
        "publishResult": {
          "$ref": "#/$defs/PublishResult"
        }
      }
    },
    "PublishResult": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "tweetId": {
          "type": "string"
        },
        "postId": {
          "type": "string"
        },
        "error": {
          "type": "string"
        },
        "attempts": {
          "type": "integer"
        }
      }
    },
    "ThreadPost": {
      "type": "object",
      "required": [
        "order"
      ],
      "properties": {
        "order": {
          "type": "integer",
          "description": "1-based sequential position, no gaps."
        },
        "text": {
          "type": "string"
        },
        "media": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MediaItem"
          }
        },
        "hashtags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "assetIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  }
}