{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/open-government-portugal/json-schema/open-government-portugal-membership-request-schema.json",
  "title": "MembershipRequest",
  "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/MembershipRequest",
  "properties": {
    "assignments": {
      "description": "Objects to assign on acceptance (for partial_editor invitations)",
      "items": {
        "$ref": "#/$defs/GenericReference"
      },
      "type": "array"
    },
    "comment": {
      "description": "A request comment from the user",
      "type": "string"
    },
    "created": {
      "description": "The request creation date",
      "format": "date-time",
      "readOnly": true,
      "type": "string"
    },
    "email": {
      "description": "Email for non-registered user invitations",
      "type": "string"
    },
    "id": {
      "readOnly": true,
      "type": "string"
    },
    "kind": {
      "default": "request",
      "description": "The request kind (request or invitation)",
      "enum": [
        "request",
        "invitation"
      ],
      "type": "string"
    },
    "role": {
      "default": "editor",
      "description": "The role to assign",
      "enum": [
        "admin",
        "editor",
        "partial_editor"
      ],
      "type": "string"
    },
    "status": {
      "description": "The current request status",
      "enum": [
        "pending",
        "accepted",
        "refused",
        "canceled"
      ],
      "type": "string"
    },
    "user": {
      "$ref": "#/$defs/MemberUserWithEmail"
    }
  },
  "required": [
    "status"
  ],
  "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"
    },
    "GenericReference": {
      "properties": {
        "class": {
          "type": "string"
        },
        "id": {
          "type": "string"
        }
      },
      "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"
        }
      ]
    },
    "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"
        }
      ]
    }
  }
}