{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postking-app/json-schema/postking-app-reddit-performance-response-schema.json",
  "title": "RedditPerformanceResponse",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/postking-app-openapi.json#/components/schemas/RedditPerformanceResponse",
  "type": "object",
  "properties": {
    "days": {
      "anyOf": [
        {
          "type": "number",
          "enum": [
            7
          ]
        },
        {
          "type": "number",
          "enum": [
            30
          ]
        },
        {
          "type": "number",
          "enum": [
            90
          ]
        }
      ]
    },
    "account": {
      "type": [
        "string",
        "null"
      ],
      "description": "Account filter applied; null = all accounts."
    },
    "accounts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "username": {
            "type": "string"
          },
          "current": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "suspended",
              "not_found"
            ]
          },
          "statusAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "firstPostedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastPostedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "lastSeenAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "posted": {
            "type": "number"
          },
          "views": {
            "type": "number"
          },
          "upvotes": {
            "type": "number"
          },
          "removed": {
            "type": "number"
          },
          "removedPct": {
            "type": "number"
          }
        },
        "required": [
          "username",
          "current",
          "status",
          "statusAt",
          "firstPostedAt",
          "lastPostedAt",
          "lastSeenAt",
          "posted",
          "views",
          "upvotes",
          "removed",
          "removedPct"
        ]
      }
    },
    "sync": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "username": {
          "type": [
            "string",
            "null"
          ]
        },
        "lastSyncAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "lastError": {
          "type": [
            "string",
            "null"
          ]
        },
        "viewsUnavailableSince": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "enabled",
        "username",
        "lastSyncAt",
        "lastError",
        "viewsUnavailableSince"
      ]
    },
    "kpis": {
      "type": "object",
      "properties": {
        "views": {
          "type": "object",
          "properties": {
            "value": {
              "type": "number"
            },
            "previous": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "value",
            "previous"
          ]
        },
        "posted": {
          "type": "object",
          "properties": {
            "value": {
              "type": "number"
            },
            "previous": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "value",
            "previous"
          ]
        },
        "upvotes": {
          "type": "object",
          "properties": {
            "value": {
              "type": "number"
            },
            "previous": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "value",
            "previous"
          ]
        },
        "removed": {
          "type": "object",
          "properties": {
            "value": {
              "type": "number"
            },
            "previous": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "value",
            "previous"
          ]
        },
        "toPost": {
          "type": "object",
          "properties": {
            "value": {
              "type": "number"
            }
          },
          "required": [
            "value"
          ]
        }
      },
      "required": [
        "views",
        "posted",
        "upvotes",
        "removed",
        "toPost"
      ]
    },
    "toPost": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "post",
              "reply"
            ]
          },
          "id": {
            "type": "string"
          },
          "platform": {
            "type": "string",
            "enum": [
              "reddit",
              "quora"
            ]
          },
          "subreddit": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "threadUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "filledAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "previewUrl": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "type",
          "id",
          "platform",
          "subreddit",
          "title",
          "threadUrl",
          "status",
          "createdAt",
          "filledAt",
          "previewUrl"
        ]
      }
    },
    "ambiguous": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "postId": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "subreddit": {
            "type": "string"
          },
          "candidates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "redditId": {
                  "type": "string",
                  "minLength": 3,
                  "maxLength": 32
                },
                "permalink": {
                  "type": "string",
                  "maxLength": 500
                },
                "subreddit": {
                  "type": "string",
                  "maxLength": 64
                },
                "title": {
                  "type": "string",
                  "maxLength": 400
                },
                "postedAt": {
                  "type": "string"
                },
                "score": {
                  "type": "integer"
                },
                "numComments": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "minimum": 0
                }
              },
              "required": [
                "redditId",
                "permalink",
                "subreddit",
                "title",
                "postedAt",
                "score"
              ]
            }
          }
        },
        "required": [
          "postId",
          "title",
          "subreddit",
          "candidates"
        ]
      }
    },
    "posted": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "post",
              "reply"
            ]
          },
          "id": {
            "type": "string"
          },
          "redditId": {
            "type": "string"
          },
          "username": {
            "type": [
              "string",
              "null"
            ]
          },
          "platform": {
            "type": "string",
            "enum": [
              "reddit",
              "quora"
            ]
          },
          "subreddit": {
            "type": [
              "string",
              "null"
            ]
          },
          "permalink": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "threadUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "postedAt": {
            "type": "string"
          },
          "score": {
            "type": [
              "number",
              "null"
            ]
          },
          "numComments": {
            "type": [
              "number",
              "null"
            ]
          },
          "viewsApprox": {
            "type": [
              "number",
              "null"
            ]
          },
          "viewsText": {
            "type": [
              "string",
              "null"
            ]
          },
          "opReplies": {
            "type": "number"
          },
          "status": {
            "type": "string",
            "enum": [
              "live",
              "removed",
              "hidden",
              "deleted"
            ]
          },
          "tracked": {
            "type": "boolean"
          },
          "postId": {
            "type": [
              "string",
              "null"
            ]
          },
          "replyDraftId": {
            "type": [
              "string",
              "null"
            ]
          },
          "spark": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string"
                },
                "score": {
                  "type": "number"
                },
                "views": {
                  "type": [
                    "number",
                    "null"
                  ]
                }
              },
              "required": [
                "date",
                "score",
                "views"
              ]
            }
          },
          "daysTo10": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "type",
          "id",
          "redditId",
          "username",
          "platform",
          "subreddit",
          "permalink",
          "title",
          "threadUrl",
          "postedAt",
          "score",
          "numComments",
          "viewsApprox",
          "viewsText",
          "opReplies",
          "status",
          "tracked",
          "postId",
          "replyDraftId",
          "spark",
          "daysTo10"
        ]
      }
    },
    "communities": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "subreddit": {
            "type": "string"
          },
          "posted": {
            "type": "number"
          },
          "views": {
            "type": "number"
          },
          "medianViews": {
            "type": [
              "number",
              "null"
            ]
          },
          "medianUpvotes": {
            "type": [
              "number",
              "null"
            ]
          },
          "removed": {
            "type": "number"
          },
          "removedPct": {
            "type": "number"
          },
          "lastPostedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "typicalDaysTo10": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "subreddit",
          "posted",
          "views",
          "medianViews",
          "medianUpvotes",
          "removed",
          "removedPct",
          "lastPostedAt",
          "typicalDaysTo10"
        ]
      }
    },
    "byType": {
      "type": "object",
      "properties": {
        "post": {
          "type": "object",
          "properties": {
            "posted": {
              "type": "number"
            },
            "views": {
              "type": "number"
            },
            "medianViews": {
              "type": [
                "number",
                "null"
              ]
            },
            "medianUpvotes": {
              "type": [
                "number",
                "null"
              ]
            },
            "removedPct": {
              "type": "number"
            },
            "typicalDaysTo10": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "posted",
            "views",
            "medianViews",
            "medianUpvotes",
            "removedPct",
            "typicalDaysTo10"
          ]
        },
        "reply": {
          "type": "object",
          "properties": {
            "posted": {
              "type": "number"
            },
            "views": {
              "type": "number"
            },
            "medianViews": {
              "type": [
                "number",
                "null"
              ]
            },
            "medianUpvotes": {
              "type": [
                "number",
                "null"
              ]
            },
            "removedPct": {
              "type": "number"
            },
            "typicalDaysTo10": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "required": [
            "posted",
            "views",
            "medianViews",
            "medianUpvotes",
            "removedPct",
            "typicalDaysTo10"
          ]
        }
      },
      "required": [
        "post",
        "reply"
      ]
    },
    "insights": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "days",
    "account",
    "accounts",
    "sync",
    "kpis",
    "toPost",
    "ambiguous",
    "posted",
    "communities",
    "byType",
    "insights"
  ]
}