{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "The caller enters the device's onboarding code and becomes the root admin: creates the home and the family sphere on the caller's PDN with parent 1 and the caller as first members.",
      "errors": [
        {
          "name": "InvalidOnboardingCode"
        },
        {
          "name": "CodeExpired"
        },
        {
          "name": "DeviceAlreadyLinked"
        },
        {
          "name": "ScopeMissing"
        },
        {
          "name": "PdsUnavailable"
        },
        {
          "name": "RateLimitExceeded"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "code": {
              "maxLength": 16,
              "type": "string"
            },
            "displayName": {
              "description": "The root admin's name as the family and the device see it (e.g. 김은수). Required by the family app; optional on the wire for compatibility.",
              "maxLength": 64,
              "type": "string"
            },
            "homeId": {
              "format": "tid",
              "type": "string"
            },
            "homeName": {
              "maxLength": 64,
              "type": "string"
            },
            "parentHonorific": {
              "description": "How the family calls parent 1 (e.g. 할머니, 어머니); written to the parentSlot record. Required by the family app.",
              "maxLength": 32,
              "type": "string"
            },
            "parentName": {
              "description": "Parent 1's name as the family and the device show it (e.g. 이순자); written to the parentSlot record. Required by the family app.",
              "maxLength": 64,
              "type": "string"
            },
            "relationship": {
              "description": "The root admin's relationship to the parents (e.g. 큰아들).",
              "maxLength": 32,
              "type": "string"
            }
          },
          "required": [
            "code",
            "homeName"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "device": {
              "ref": "ai.newnal.illi.home.defs#deviceView",
              "type": "ref"
            },
            "homeId": {
              "format": "tid",
              "type": "string"
            },
            "role": {
              "knownValues": [
                "rootAdmin"
              ],
              "type": "string"
            },
            "sphere": {
              "type": "string"
            }
          },
          "required": [
            "homeId",
            "sphere",
            "role",
            "device"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "ai.newnal.illi.device.link",
  "lexicon": 1
}
