{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/open-government-portugal/json-schema/open-government-portugal-report-page-schema.json",
  "title": "ReportPage",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/open-government-portugal-reports-api-openapi.yml#/components/schemas/ReportPage",
  "properties": {
    "data": {
      "description": "The page data",
      "items": {
        "$ref": "#/$defs/Report__read"
      },
      "type": "array"
    },
    "next_page": {
      "description": "The next page URL if exists",
      "type": "string"
    },
    "page": {
      "description": "The current page",
      "minimum": 1,
      "type": "integer"
    },
    "page_size": {
      "description": "The page size used for pagination",
      "minimum": 0,
      "type": "integer"
    },
    "previous_page": {
      "description": "The previous page URL if exists",
      "type": "string"
    },
    "total": {
      "description": "The total paginated items",
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "page",
    "page_size",
    "total"
  ],
  "type": "object",
  "$defs": {
    "BaseReference": {
      "properties": {
        "class": {
          "description": "The object class",
          "type": "string"
        },
        "id": {
          "description": "The object unique identifier",
          "type": "string"
        }
      },
      "required": [
        "class",
        "id"
      ],
      "type": "object"
    },
    "LazyReference": {
      "properties": {
        "class": {
          "type": "object"
        },
        "id": {
          "type": "object"
        }
      },
      "type": "object"
    },
    "Report__read": {
      "properties": {
        "by": {
          "allOf": [
            {
              "$ref": "#/$defs/UserReference"
            }
          ],
          "description": "Only set if a user was connected when reporting an element.",
          "readOnly": true
        },
        "callbacks": {
          "readOnly": true,
          "type": "object"
        },
        "dismissed_at": {
          "format": "date-time",
          "type": "string"
        },
        "dismissed_by": {
          "$ref": "#/$defs/UserReference"
        },
        "id": {
          "readOnly": true,
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "reason": {
          "enum": [
            "auto_spam",
            "explicit_content",
            "illegal_content",
            "others",
            "personal_data",
            "security",
            "spam"
          ],
          "type": "string"
        },
        "reported_at": {
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "self_api_url": {
          "description": "Link to the API endpoint for this report",
          "readOnly": true,
          "type": "string"
        },
        "subject": {
          "$ref": "#/$defs/LazyReference"
        },
        "subject_deleted_at": {
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "subject_embed_id": {
          "description": "UUID of the embedded document within the subject (e.g., a Message within a Discussion)",
          "type": "string"
        }
      },
      "required": [
        "id",
        "reason",
        "reported_at"
      ],
      "type": "object"
    },
    "UserReference": {
      "allOf": [
        {
          "$ref": "#/$defs/BaseReference"
        },
        {
          "properties": {
            "avatar": {
              "description": "The user avatar URL",
              "type": "string"
            },
            "avatar_thumbnail": {
              "description": "The user avatar thumbnail URL. This is the square (500x500) and cropped version.",
              "type": "string"
            },
            "first_name": {
              "description": "The user first name",
              "readOnly": true,
              "type": "string"
            },
            "last_name": {
              "description": "The user larst name",
              "readOnly": true,
              "type": "string"
            },
            "page": {
              "description": "The user web page URL",
              "readOnly": true,
              "type": "string"
            },
            "slug": {
              "description": "The user permalink string",
              "readOnly": true,
              "type": "string"
            },
            "uri": {
              "description": "The API URI for this user",
              "readOnly": true,
              "type": "string"
            }
          },
          "type": "object"
        }
      ]
    }
  }
}