{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/codai-ro/json-schema/codai-ro-org-create-share-body-schema.json",
  "title": "Create share body",
  "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/OrgCreateShareBody",
  "type": "object",
  "required": [
    "principal_type"
  ],
  "properties": {
    "principal_type": {
      "$ref": "#/$defs/OrgSharePrincipalType"
    },
    "principal_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "Required (user or org UUID) for `user` and `org`; forbidden for `link`."
    },
    "role": {
      "allOf": [
        {
          "$ref": "#/$defs/OrgSessionRole"
        }
      ],
      "default": "viewer",
      "description": "Role to grant. Default `viewer`."
    },
    "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 with offset; must be in the future. Omit for no expiry."
    }
  },
  "$defs": {
    "OrgSessionRole": {
      "type": "string",
      "description": "Role granted on a session.",
      "enum": [
        "viewer",
        "editor",
        "owner"
      ]
    },
    "OrgSharePrincipalType": {
      "type": "string",
      "description": "Who a share is for.",
      "enum": [
        "user",
        "org",
        "link"
      ]
    }
  }
}