{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "A clinician leaves an institution: their role there ends now. It's their own act, honored at once, since giving up a role only removes access; an administrator revokes the role credential after. The institution's node writes the ended PractitionerRole and a Provenance naming the clinician. Authenticated as the clinician (service auth).",
      "errors": [
        {
          "description": "The caller holds no role in force at that institution.",
          "name": "NoRole"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "institution": {
              "description": "The institution, by its DID.",
              "format": "did",
              "type": "string"
            }
          },
          "required": [
            "institution"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "endedAt": {
              "format": "datetime",
              "type": "string"
            },
            "role": {
              "description": "The ended PractitionerRole, which stays published with its end date.",
              "format": "at-uri",
              "type": "string"
            }
          },
          "required": [
            "role",
            "endedAt"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "health.hats.institution.leaveRole",
  "lexicon": 1
}
