{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/schedulin-app/json-schema/schedulin-app-post-with-relations-schema.json",
  "title": "PostWithRelations",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/schedulin-app-openapi.json#/components/schemas/PostWithRelations",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "externalId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "caption": {
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/PostStatus"
    },
    "approvalStatus": {
      "$ref": "#/$defs/PostApprovalStatus"
    },
    "approvalRequestedAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "approvalRequestedBy": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "approvedAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "approvedBy": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "rejectionReason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "scheduledAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "platformConfiguration": {
      "anyOf": [
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        },
        {
          "type": "null"
        }
      ]
    },
    "socialAccountId": {
      "type": "string"
    },
    "url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "postedAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        },
        {
          "type": "null"
        }
      ]
    },
    "errorMessage": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "x-native-type": "date"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "x-native-type": "date"
    },
    "socialAccount": {
      "$ref": "#/$defs/SocialAccount"
    },
    "media": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PostMedia"
      }
    },
    "thumbnail": {
      "anyOf": [
        {
          "$ref": "#/$defs/PostMedia"
        },
        {
          "type": "null"
        }
      ]
    },
    "tags": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Tag"
      }
    },
    "parts": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PostThreadPart"
      }
    }
  },
  "required": [
    "id",
    "externalId",
    "caption",
    "status",
    "approvalStatus",
    "approvalRequestedAt",
    "approvalRequestedBy",
    "approvedAt",
    "approvedBy",
    "rejectionReason",
    "scheduledAt",
    "platformConfiguration",
    "socialAccountId",
    "url",
    "title",
    "postedAt",
    "errorMessage",
    "createdAt",
    "updatedAt",
    "socialAccount",
    "media",
    "thumbnail",
    "tags",
    "parts"
  ],
  "$defs": {
    "ImageProcessingStatus": {
      "enum": [
        "PENDING",
        "PROCESSING",
        "PROCESSED",
        "FAILED"
      ],
      "type": "string"
    },
    "PostApprovalStatus": {
      "enum": [
        "DRAFT",
        "PENDING_APPROVAL",
        "APPROVED",
        "REJECTED"
      ],
      "type": "string"
    },
    "PostMedia": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "mimeType": {
          "type": "string"
        },
        "width": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "height": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "duration": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "size": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "alt": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 1000
            },
            {
              "type": "null"
            }
          ]
        },
        "thumbnailUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "type": {
                "enum": [
                  "user",
                  "business"
                ],
                "type": "string"
              },
              "platform": {
                "enum": [
                  "bluesky",
                  "facebook",
                  "google_business_profile",
                  "instagram",
                  "linkedin",
                  "pinterest",
                  "reddit",
                  "snapchat",
                  "threads",
                  "tiktok",
                  "tiktok_business",
                  "twitter",
                  "youtube",
                  "mastodon",
                  "telegram",
                  "devto",
                  "hashnode",
                  "medium",
                  "wordpress",
                  "lemmy",
                  "nostr",
                  "discord",
                  "dribbble",
                  "farcaster",
                  "kick",
                  "listmonk",
                  "mewe",
                  "moltbook",
                  "skool",
                  "slack",
                  "twitch",
                  "vk",
                  "whop"
                ],
                "type": "string"
              },
              "x": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "y": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": [
              "id",
              "type",
              "platform"
            ]
          }
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        }
      },
      "required": [
        "id",
        "url",
        "name",
        "mimeType",
        "width",
        "height",
        "duration",
        "size",
        "alt",
        "thumbnailUrl",
        "createdAt",
        "updatedAt"
      ]
    },
    "PostStatus": {
      "enum": [
        "SCHEDULED",
        "PROCESSING",
        "COMPLETED",
        "DRAFT",
        "FAILED",
        "DELETED"
      ],
      "type": "string"
    },
    "PostThreadPart": {
      "type": "object",
      "properties": {
        "caption": {
          "type": "string"
        },
        "media": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PostMedia"
          }
        }
      },
      "required": [
        "caption",
        "media"
      ]
    },
    "SocialAccount": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "platform": {
          "$ref": "#/$defs/SocialPlatform"
        },
        "imageUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "imageProcessingStatus": {
          "$ref": "#/$defs/ImageProcessingStatus"
        },
        "username": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "status": {
          "enum": [
            "connected",
            "disconnected"
          ],
          "type": "string"
        },
        "disconnectedReason": {
          "$ref": "#/$defs/SocialAccountDisconnectedReason"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        },
        "refreshTokenValid": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "platform",
        "imageUrl",
        "imageProcessingStatus",
        "username",
        "status",
        "disconnectedReason",
        "createdAt",
        "updatedAt",
        "refreshTokenValid"
      ]
    },
    "SocialAccountDisconnectedReason": {
      "anyOf": [
        {
          "enum": [
            "TOKEN_EXPIRED",
            "TOKEN_INVALID",
            "TOKEN_REVOKED",
            "REFRESH_FAILED",
            "ACCOUNT_SUSPENDED",
            "PERMISSION_DENIED",
            "EMAIL_UNCONFIRMED"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "SocialPlatform": {
      "enum": [
        "bluesky",
        "facebook",
        "google_business_profile",
        "instagram",
        "linkedin",
        "pinterest",
        "reddit",
        "snapchat",
        "threads",
        "tiktok",
        "tiktok_business",
        "twitter",
        "youtube",
        "mastodon",
        "telegram",
        "devto",
        "hashnode",
        "medium",
        "wordpress",
        "lemmy",
        "nostr",
        "discord",
        "dribbble",
        "farcaster",
        "kick",
        "listmonk",
        "mewe",
        "moltbook",
        "skool",
        "slack",
        "twitch",
        "vk",
        "whop"
      ],
      "type": "string"
    },
    "Tag": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "x-native-type": "date"
        }
      },
      "required": [
        "id",
        "name",
        "color",
        "createdAt",
        "updatedAt"
      ]
    }
  }
}