{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postproxy-dev/json-schema/postproxy-dev-profile-comment-schema.json",
  "title": "ProfileComment",
  "description": "A profile-scoped comment — a Google Business Profile review, a Facebook Page recommendation, or a reply to one.",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/postproxy-dev-openapi.json#/components/schemas/ProfileComment",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Postproxy comment ID (hashid)"
    },
    "external_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Platform's native resource ID (null while a reply is pending publication)"
    },
    "parent_external_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "External ID of parent review (null for top-level reviews)"
    },
    "placement_id": {
      "type": "string",
      "description": "Location path (e.g. accounts/X/locations/Y)"
    },
    "body": {
      "type": [
        "string",
        "null"
      ],
      "description": "Comment/review text. Google Business reviews can be star-only: body is null while platform_data.star_rating is still populated."
    },
    "status": {
      "type": "string",
      "enum": [
        "synced",
        "pending",
        "published",
        "failed",
        "failed_waiting_for_retry",
        "deleted"
      ]
    },
    "error": {
      "type": [
        "string",
        "null"
      ],
      "description": "Error summary if an outgoing reply failed (null otherwise)"
    },
    "error_details": {
      "$ref": "#/$defs/PlatformErrorDetails"
    },
    "author_username": {
      "type": [
        "string",
        "null"
      ],
      "description": "Display name of reviewer (null for your own replies)"
    },
    "author_avatar_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Profile image URL"
    },
    "platform_data": {
      "type": [
        "object",
        "null"
      ],
      "description": "Platform-specific metadata (e.g. star_rating, update_time for Google reviews; recommendation_type for Facebook recommendations)",
      "additionalProperties": true
    },
    "permalink": {
      "type": [
        "string",
        "null"
      ],
      "description": "URL to the comment on the platform (the location's reviews page on Google or the Page's reviews tab on Facebook — shared by all reviews and replies on that location / Page; null if unavailable)"
    },
    "posted_at": {
      "type": [
        "string",
        "null"
      ],
      "description": "ISO 8601 timestamp of platform posting"
    },
    "created_at": {
      "type": "string",
      "description": "ISO 8601 timestamp of record creation"
    },
    "replies": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProfileComment"
      },
      "description": "Nested replies to this comment, sorted by created_at ascending (present on list/get responses)"
    }
  },
  "$defs": {
    "PlatformErrorDetails": {
      "type": [
        "object",
        "null"
      ],
      "description": "Structured platform error (omitted when no platform error info is available).",
      "properties": {
        "platform_error_code": {
          "type": [
            "string",
            "null"
          ],
          "description": "Error code returned by the platform API"
        },
        "platform_error_subcode": {
          "type": [
            "string",
            "null"
          ],
          "description": "Error subcode returned by the platform API"
        },
        "platform_error_message": {
          "type": [
            "string",
            "null"
          ],
          "description": "Error message returned by the platform API"
        },
        "postproxy_note": {
          "type": [
            "string",
            "null"
          ],
          "description": "Additional context from Postproxy about the error"
        }
      }
    },
    "ProfileComment": {
      "type": "object",
      "description": "A profile-scoped comment — a Google Business Profile review, a Facebook Page recommendation, or a reply to one.",
      "properties": {
        "id": {
          "type": "string",
          "description": "Postproxy comment ID (hashid)"
        },
        "external_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Platform's native resource ID (null while a reply is pending publication)"
        },
        "parent_external_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "External ID of parent review (null for top-level reviews)"
        },
        "placement_id": {
          "type": "string",
          "description": "Location path (e.g. accounts/X/locations/Y)"
        },
        "body": {
          "type": [
            "string",
            "null"
          ],
          "description": "Comment/review text. Google Business reviews can be star-only: body is null while platform_data.star_rating is still populated."
        },
        "status": {
          "type": "string",
          "enum": [
            "synced",
            "pending",
            "published",
            "failed",
            "failed_waiting_for_retry",
            "deleted"
          ]
        },
        "error": {
          "type": [
            "string",
            "null"
          ],
          "description": "Error summary if an outgoing reply failed (null otherwise)"
        },
        "error_details": {
          "$ref": "#/$defs/PlatformErrorDetails"
        },
        "author_username": {
          "type": [
            "string",
            "null"
          ],
          "description": "Display name of reviewer (null for your own replies)"
        },
        "author_avatar_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Profile image URL"
        },
        "platform_data": {
          "type": [
            "object",
            "null"
          ],
          "description": "Platform-specific metadata (e.g. star_rating, update_time for Google reviews; recommendation_type for Facebook recommendations)",
          "additionalProperties": true
        },
        "permalink": {
          "type": [
            "string",
            "null"
          ],
          "description": "URL to the comment on the platform (the location's reviews page on Google or the Page's reviews tab on Facebook — shared by all reviews and replies on that location / Page; null if unavailable)"
        },
        "posted_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "ISO 8601 timestamp of platform posting"
        },
        "created_at": {
          "type": "string",
          "description": "ISO 8601 timestamp of record creation"
        },
        "replies": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProfileComment"
          },
          "description": "Nested replies to this comment, sorted by created_at ascending (present on list/get responses)"
        }
      }
    }
  }
}