{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/codai-ro/json-schema/codai-ro-org-shared-session-schema.json",
  "title": "Shared session",
  "description": "A session object (same wire shape as `GET /v1/sessions/{id}`) plus your effective role and the share that grants it.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/codai-ro-orgs-sharing-api-openapi.yml#/components/schemas/OrgSharedSession",
  "type": "object",
  "required": [
    "id",
    "session_key",
    "owner_user_id",
    "title",
    "created_at",
    "last_event_at",
    "last_seq",
    "executor_device_id",
    "lease_expires_at",
    "e2e",
    "archived",
    "role",
    "share_id"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "session_key": {
      "type": "string",
      "description": "The owner's `x-codai-session-id` value."
    },
    "owner_user_id": {
      "type": "string",
      "format": "uuid"
    },
    "title": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "last_event_at": {
      "type": "string",
      "format": "date-time"
    },
    "last_seq": {
      "type": "integer",
      "description": "Sequence number of the latest event."
    },
    "executor_device_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid"
    },
    "lease_expires_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "e2e": {
      "type": "boolean"
    },
    "archived": {
      "type": "boolean"
    },
    "role": {
      "$ref": "#/$defs/OrgSessionRole"
    },
    "share_id": {
      "type": "string",
      "format": "uuid",
      "description": "The share granting the highest role."
    }
  },
  "$defs": {
    "OrgSessionRole": {
      "type": "string",
      "description": "Role granted on a session.",
      "enum": [
        "viewer",
        "editor",
        "owner"
      ]
    }
  }
}