{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/open-government-portugal/json-schema/open-government-portugal-community-resource-page-schema.json",
  "title": "CommunityResourcePage",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/open-government-portugal-datasets-api-openapi.yml#/components/schemas/CommunityResourcePage",
  "properties": {
    "data": {
      "description": "The page data",
      "items": {
        "$ref": "#/$defs/CommunityResource"
      },
      "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": {
    "Badge__read": {
      "properties": {
        "kind": {
          "type": "string"
        }
      },
      "required": [
        "kind"
      ],
      "type": "object"
    },
    "BaseReference": {
      "properties": {
        "class": {
          "description": "The object class",
          "type": "string"
        },
        "id": {
          "description": "The object unique identifier",
          "type": "string"
        }
      },
      "required": [
        "class",
        "id"
      ],
      "type": "object"
    },
    "Checksum": {
      "properties": {
        "type": {
          "default": "sha1",
          "description": "The hashing algorithm used to compute the checksum",
          "enum": [
            "sha1",
            "sha2",
            "sha256",
            "md5",
            "crc"
          ],
          "type": "string"
        },
        "value": {
          "description": "The resulting checksum/hash",
          "type": "string"
        }
      },
      "required": [
        "value"
      ],
      "type": "object"
    },
    "CommunityResource": {
      "allOf": [
        {
          "$ref": "#/$defs/Resource"
        },
        {
          "properties": {
            "dataset": {
              "allOf": [
                {
                  "$ref": "#/$defs/DatasetReference"
                }
              ],
              "description": "Reference to the associated dataset"
            },
            "organization": {
              "allOf": [
                {
                  "$ref": "#/$defs/OrganizationReference"
                }
              ],
              "description": "The producer organization"
            },
            "owner": {
              "allOf": [
                {
                  "$ref": "#/$defs/UserReference"
                }
              ],
              "description": "The user information"
            },
            "permissions": {
              "$ref": "#/$defs/DatasetPermissions"
            }
          },
          "type": "object"
        }
      ]
    },
    "DatasetPermissions": {
      "properties": {
        "delete": {
          "type": "boolean"
        },
        "edit": {
          "type": "boolean"
        },
        "edit_resources": {
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "DatasetReference": {
      "allOf": [
        {
          "$ref": "#/$defs/BaseReference"
        },
        {
          "properties": {},
          "type": "object"
        }
      ]
    },
    "HarvestResourceMetadata": {
      "properties": {
        "issued_at": {
          "description": "The resource harvested release date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "modified_at": {
          "description": "The resource harvest last modification date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "uri": {
          "description": "The resource harvest uri",
          "type": "string"
        }
      },
      "type": "object"
    },
    "OrganizationPermissions": {
      "properties": {
        "delete": {
          "type": "boolean"
        },
        "edit": {
          "type": "boolean"
        },
        "harvest": {
          "type": "boolean"
        },
        "members": {
          "type": "boolean"
        },
        "private": {
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "OrganizationReference": {
      "allOf": [
        {
          "$ref": "#/$defs/BaseReference"
        },
        {
          "properties": {
            "acronym": {
              "description": "The organization acronym",
              "type": "string"
            },
            "badges": {
              "description": "The organization badges",
              "items": {
                "$ref": "#/$defs/Badge__read"
              },
              "readOnly": true,
              "type": "array"
            },
            "logo": {
              "description": "The organization logo URL",
              "type": "string"
            },
            "logo_thumbnail": {
              "description": "The organization logo thumbnail URL. This is the square (100x100) and cropped version.",
              "type": "string"
            },
            "name": {
              "description": "The organization name",
              "readOnly": true,
              "type": "string"
            },
            "page": {
              "description": "The organization web page URL",
              "readOnly": true,
              "type": "string"
            },
            "permissions": {
              "allOf": [
                {
                  "$ref": "#/$defs/OrganizationPermissions"
                }
              ],
              "readOnly": true
            },
            "slug": {
              "description": "The organization string used as permalink",
              "readOnly": true,
              "type": "string"
            },
            "uri": {
              "description": "The API URI for this organization",
              "readOnly": true,
              "type": "string"
            }
          },
          "type": "object"
        }
      ]
    },
    "Resource": {
      "properties": {
        "checksum": {
          "allOf": [
            {
              "$ref": "#/$defs/Checksum"
            }
          ],
          "description": "A checksum to validate file validity"
        },
        "created_at": {
          "description": "The resource creation date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "description": {
          "description": "The resource markdown description",
          "format": "markdown",
          "type": "string"
        },
        "extras": {
          "description": "Extra attributes as key-value pairs",
          "type": "object"
        },
        "filesize": {
          "description": "The resource file size in bytes",
          "type": "integer"
        },
        "filetype": {
          "description": "Whether the resource is an uploaded file, a remote file or an API",
          "enum": [
            "file",
            "remote"
          ],
          "type": "string"
        },
        "format": {
          "description": "The resource format",
          "type": "string"
        },
        "harvest": {
          "allOf": [
            {
              "$ref": "#/$defs/HarvestResourceMetadata"
            }
          ],
          "description": "Harvest attributes metadata information",
          "readOnly": true
        },
        "id": {
          "description": "The resource unique ID",
          "readOnly": true,
          "type": "string"
        },
        "internal": {
          "allOf": [
            {
              "$ref": "#/$defs/ResourceInternals"
            }
          ],
          "description": "Site internal and specific object's data",
          "readOnly": true
        },
        "last_modified": {
          "description": "The resource last modification date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "latest": {
          "description": "The permanent URL redirecting to the latest version of the resource. When the resource data is updated, the URL will change, the latest URL won't.",
          "readOnly": true,
          "type": "string"
        },
        "metrics": {
          "description": "The resource metrics",
          "readOnly": true,
          "type": "object"
        },
        "mime": {
          "description": "The resource mime type",
          "type": "string"
        },
        "preview_url": {
          "description": "An optional preview URL to be loaded as a standalone page (ie. iframe or new page)",
          "readOnly": true,
          "type": "string"
        },
        "schema": {
          "allOf": [
            {
              "$ref": "#/$defs/Schema"
            }
          ],
          "description": "Reference to the associated schema"
        },
        "title": {
          "description": "The resource title",
          "type": "string"
        },
        "type": {
          "description": "Resource type (documentation, API...)",
          "enum": [
            "main",
            "documentation",
            "update",
            "api",
            "code",
            "other"
          ],
          "type": "string"
        },
        "url": {
          "description": "The resource URL",
          "type": "string"
        }
      },
      "required": [
        "filetype",
        "format",
        "title",
        "type",
        "url"
      ],
      "type": "object"
    },
    "ResourceInternals": {
      "properties": {
        "created_at_internal": {
          "description": "The resource's internal creation date on the site",
          "format": "date-time",
          "type": "string"
        },
        "last_modified_internal": {
          "description": "The resource's internal last modification date",
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "created_at_internal",
        "last_modified_internal"
      ],
      "type": "object"
    },
    "Schema": {
      "properties": {
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "version": {
          "type": "string"
        }
      },
      "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"
        }
      ]
    }
  }
}