{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/open-government-portugal/json-schema/open-government-portugal-organization-search-page-schema.json",
  "title": "OrganizationSearchPage",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/open-government-portugal-organizations-api-openapi.yml#/components/schemas/OrganizationSearchPage",
  "properties": {
    "data": {
      "description": "The page data",
      "items": {
        "$ref": "#/$defs/Organization"
      },
      "type": "array"
    },
    "facets": {
      "description": "Facets/aggregations for filtering",
      "type": "object"
    },
    "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"
    },
    "Member": {
      "properties": {
        "label": {
          "readOnly": true,
          "type": "string"
        },
        "role": {
          "default": "editor",
          "description": "The member role in the organization",
          "enum": [
            "admin",
            "editor",
            "partial_editor"
          ],
          "type": "string"
        },
        "since": {
          "description": "The date the user joined the organization",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "user": {
          "$ref": "#/$defs/MemberUserWithEmail"
        }
      },
      "required": [
        "role"
      ],
      "type": "object"
    },
    "MemberUserWithEmail": {
      "allOf": [
        {
          "$ref": "#/$defs/UserReference"
        },
        {
          "properties": {
            "email": {
              "description": "The user email (only present on show organization endpoint if the current user is member of the organization: admin or editor)",
              "readOnly": true,
              "type": "object"
            },
            "last_login_at": {
              "description": "The user last connection date (only present on show organization endpoint if the current user is member of the organization: admin or editor)",
              "readOnly": true,
              "type": "object"
            }
          },
          "type": "object"
        }
      ]
    },
    "Organization": {
      "properties": {
        "acronym": {
          "description": "The organization acronym",
          "type": "string"
        },
        "badges": {
          "description": "The organization badges",
          "items": {
            "$ref": "#/$defs/Badge__read"
          },
          "readOnly": true,
          "type": "array"
        },
        "business_number_id": {
          "description": "The organization's business identification number.",
          "type": "string"
        },
        "created_at": {
          "description": "The organization creation date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "deleted": {
          "description": "The organization deletion date if deleted",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "description": {
          "description": "The organization description in Markdown",
          "format": "markdown",
          "type": "string"
        },
        "extras": {
          "description": "Extras attributes as key-value pairs",
          "type": "object"
        },
        "id": {
          "description": "The organization identifier",
          "readOnly": true,
          "type": "string"
        },
        "last_modified": {
          "description": "The organization last modification date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "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"
        },
        "members": {
          "items": {
            "allOf": [
              {
                "$ref": "#/$defs/Member"
              }
            ],
            "description": "The organization members"
          },
          "type": "array"
        },
        "metrics": {
          "description": "The organization metrics",
          "readOnly": true,
          "type": "object"
        },
        "name": {
          "description": "The organization name",
          "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"
        },
        "url": {
          "description": "The organization website URL",
          "type": "string"
        }
      },
      "required": [
        "description",
        "name"
      ],
      "type": "object"
    },
    "OrganizationPermissions": {
      "properties": {
        "delete": {
          "type": "boolean"
        },
        "edit": {
          "type": "boolean"
        },
        "harvest": {
          "type": "boolean"
        },
        "members": {
          "type": "boolean"
        },
        "private": {
          "type": "boolean"
        }
      },
      "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"
        }
      ]
    }
  }
}