{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/clarifymedical/json-schema/clarifymedical-create-object-record-access-request-dto-schema.json",
  "title": "CreateObjectRecordAccessRequestDto",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/clarifymedical-recordaccess-api-openapi.yml#/components/schemas/CreateObjectRecordAccessRequestDto",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "object-record-access"
          ]
        },
        "attributes": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "grantee_type": {
                  "type": "string",
                  "enum": [
                    "user"
                  ],
                  "description": "Share the record with a single workspace member."
                },
                "grantee_id": {
                  "type": "string",
                  "description": "The unique ID of the user to share the record with."
                },
                "access_level": {
                  "type": "string",
                  "enum": [
                    "view",
                    "edit"
                  ],
                  "description": "The level of access to grant: `view` for read-only access, `edit` for read-write access."
                },
                "notify": {
                  "type": "boolean",
                  "description": "Whether to notify the grantee that the record was shared with them. Defaults to `true`. Ignored for `workspace` grants, which never notify."
                }
              },
              "required": [
                "grantee_type",
                "grantee_id",
                "access_level"
              ]
            },
            {
              "type": "object",
              "properties": {
                "grantee_type": {
                  "type": "string",
                  "enum": [
                    "workspace"
                  ],
                  "description": "Share the record with everyone in the workspace."
                },
                "grantee_id": {
                  "type": "null",
                  "description": "Must be `null` for a workspace-wide grant."
                },
                "access_level": {
                  "type": "string",
                  "enum": [
                    "view",
                    "edit"
                  ],
                  "description": "The level of access to grant: `view` for read-only access, `edit` for read-write access."
                },
                "notify": {
                  "type": "boolean",
                  "description": "Whether to notify the grantee that the record was shared with them. Defaults to `true`. Ignored for `workspace` grants, which never notify."
                }
              },
              "required": [
                "grantee_type",
                "grantee_id",
                "access_level"
              ]
            }
          ]
        }
      },
      "required": [
        "type",
        "attributes"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data"
  ]
}