{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/coactive/main/json-schema/coactive-user-invitation-list-response-schema.json",
  "title": "UserInvitationListResponse",
  "description": "Response model for listing user invitations.\n\nThis model contains a list of pending user invitations and metadata about the\npagination of the results. Each invitation includes details about who sent it,\nwho it was sent to, and the roles that will be assigned upon acceptance.",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/coactive-user-management-api-openapi.yml#/components/schemas/UserInvitationListResponse",
  "type": "object",
  "properties": {
    "user_invitations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/UserInvitation"
      },
      "description": "List of pending invitations"
    },
    "meta": {
      "$ref": "#/$defs/PagedMeta",
      "description": "Pagination metadata for the response"
    }
  },
  "required": [
    "user_invitations",
    "meta"
  ],
  "$defs": {
    "Invitee": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "description": "Email address of the invitee"
        },
        "name": {
          "type": "string",
          "description": "Display name of the invitee"
        },
        "roles": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Role"
          },
          "description": "List of roles to assign to the invitee"
        }
      },
      "required": [
        "email",
        "name",
        "roles"
      ],
      "title": "Invitee"
    },
    "Inviter": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Display name of the inviter"
        }
      },
      "required": [
        "name"
      ],
      "description": "Model representing the user who sent the invitation.\n\nThis model contains the details of the user who sent the invitation, including\ntheir display name.",
      "title": "Inviter"
    },
    "PagedLinks": {
      "type": "object",
      "properties": {
        "prev": {
          "type": [
            "string",
            "null"
          ],
          "description": "URL for the previous page"
        },
        "next": {
          "type": [
            "string",
            "null"
          ],
          "description": "URL for the next page"
        },
        "first": {
          "type": [
            "string",
            "null"
          ],
          "description": "URL for the first page"
        },
        "last": {
          "type": [
            "string",
            "null"
          ],
          "description": "URL for the last page"
        }
      },
      "description": "Metadata for retrieving paginated data",
      "title": "PagedLinks"
    },
    "PagedMeta": {
      "type": "object",
      "properties": {
        "page": {
          "$ref": "#/$defs/PagedPageDetails",
          "description": "Current page number (1-indexed)"
        },
        "links": {
          "$ref": "#/$defs/PagedLinks",
          "description": "Links to the previous, next, first, and last pages"
        },
        "sort": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SortItem1"
          },
          "description": "Sort order for the response"
        }
      },
      "required": [
        "page",
        "links",
        "sort"
      ],
      "description": "Metadata for paginated responses",
      "title": "PagedMeta"
    },
    "PagedPageDetails": {
      "type": "object",
      "properties": {
        "current_page": {
          "type": "integer",
          "description": "Current page number (1-indexed)"
        },
        "last_page": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Last page number (if total is known)"
        },
        "limit": {
          "type": "integer",
          "description": "Number of items per page"
        },
        "offset": {
          "type": "integer",
          "description": "Offset of the first item in the current page"
        },
        "total": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Total number of items across all pages"
        }
      },
      "required": [
        "current_page",
        "limit",
        "offset"
      ],
      "description": "Pagination metadata",
      "title": "PagedPageDetails"
    },
    "Role": {
      "type": "object",
      "properties": {
        "role_id": {
          "type": "string",
          "description": "Name of the role (e.g., 'admin', 'editor', 'viewer')"
        },
        "resource": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional resource type the role applies to (e.g., 'dataset')"
        },
        "resource_instance": {
          "type": [
            "string",
            "null"
          ],
          "description": "Optional resource instance ID the role applies to"
        }
      },
      "required": [
        "role_id"
      ],
      "description": "Role model for user and client roles",
      "title": "Role"
    },
    "SortDirection1": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ],
      "description": "Possible sort orders",
      "title": "SortDirection1"
    },
    "SortItem1": {
      "type": "object",
      "properties": {
        "direction": {
          "$ref": "#/$defs/SortDirection1",
          "description": "Sort direction (ascending or descending)"
        },
        "field": {
          "type": "string",
          "description": "Field name to sort by"
        }
      },
      "required": [
        "direction",
        "field"
      ],
      "description": "Metadata about the sort order of the response",
      "title": "SortItem1"
    },
    "UserInvitation": {
      "type": "object",
      "properties": {
        "invitation_id": {
          "type": "string",
          "description": "Unique identifier for the invitation"
        },
        "inviter": {
          "$ref": "#/$defs/Inviter",
          "description": "Details about the user who sent the invitation"
        },
        "invitee": {
          "$ref": "#/$defs/Invitee",
          "description": "Details about the user being invited"
        },
        "invitation_url": {
          "type": "string",
          "description": "URL for the user to accept the invitation"
        },
        "created_at": {
          "type": "string",
          "description": "Timestamp when the invitation was created"
        },
        "expires_at": {
          "type": "string",
          "description": "Timestamp when the invitation expires"
        },
        "roles": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Role"
          },
          "description": "List of roles that will be assigned upon acceptance"
        }
      },
      "required": [
        "invitation_id",
        "inviter",
        "invitee",
        "invitation_url",
        "created_at",
        "expires_at",
        "roles"
      ],
      "description": "Model representing a user invitation.\n\nThis model contains the details of an invitation sent to a user, including the\ninvitation ID, who sent it, who it was sent to, and the roles that will be\nassigned upon acceptance. The invitation URL is included for the user to accept\nthe invitation.",
      "title": "UserInvitation"
    }
  }
}