{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Root or main admin writes one My Data record in the parent's name: the collection's #section (rkey self) or one #entry (rkey absent = a new item, else the item to replace). Validated against the platform's published lexicon and ILLI's checks (dates, times, durations, RRULE, codes; a section saying 'none' must have no item of that kind). Written with the parent's delegated session, followed by its provenance (agent = the caller, method reported_by_other); the previous value goes to the audit log; a 'skipped' or 'not sure' state of the answered question is cleared. expectedCid, when given, must be the current CID (RecordChanged otherwise, with the current record in the message). Emits changed {collection: \"mydata\"}.",
      "errors": [
        {
          "name": "NotMember"
        },
        {
          "name": "NotAdmin"
        },
        {
          "name": "HomeNotFound"
        },
        {
          "name": "ParentNotLinked"
        },
        {
          "name": "InvalidRecord"
        },
        {
          "name": "RecordChanged"
        },
        {
          "name": "DelegationUnavailable"
        },
        {
          "name": "PdsUnavailable"
        },
        {
          "name": "RequestConflict"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "collection": {
              "ref": "ai.newnal.illi.mydata.defs#collection",
              "type": "ref"
            },
            "data": {
              "description": "The `data` of one My Data record: the collection's #section (one record at rkey self) or #entry (one record per item), as the platform's published lexicon defines it. $type names the def.",
              "refs": [
                "ai.newnal.mydata.healthFunctionalAbilities#entry",
                "ai.newnal.mydata.healthMedicalEvents#section",
                "ai.newnal.mydata.healthMedicalEvents#entry",
                "ai.newnal.mydata.healthAllergies#section",
                "ai.newnal.mydata.healthAllergies#entry",
                "ai.newnal.mydata.healthMedications#section",
                "ai.newnal.mydata.healthMedications#entry",
                "ai.newnal.mydata.healthHealthStatus#section",
                "ai.newnal.mydata.healthHealthStatus#entry",
                "ai.newnal.mydata.interestsAndTastesTravel#section",
                "ai.newnal.mydata.interestsAndTastesHobbies#section",
                "ai.newnal.mydata.interestsAndTastesHobbies#entry",
                "ai.newnal.mydata.interestsAndTastesFood#section",
                "ai.newnal.mydata.interestsAndTastesGeneral#entry",
                "ai.newnal.mydata.interestsAndTastesMedia#section",
                "ai.newnal.mydata.interestsAndTastesNews#section",
                "ai.newnal.mydata.interestsAndTastesFavoriteWorks#entry",
                "ai.newnal.mydata.interestsAndTastesFavoriteCreators#entry",
                "ai.newnal.mydata.capabilitiesSkillsAndKnowledge#entry",
                "ai.newnal.mydata.valuesAndGoalsGoals#entry",
                "ai.newnal.mydata.profileScheduleActivities#entry",
                "ai.newnal.mydata.lifestyleHabits#entry",
                "ai.newnal.mydata.profileIdentity#section",
                "ai.newnal.mydata.profileBirth#section",
                "ai.newnal.mydata.profileRepresentation#section"
              ],
              "type": "union"
            },
            "expectedCid": {
              "format": "cid",
              "type": "string"
            },
            "homeId": {
              "format": "tid",
              "type": "string"
            },
            "itemKeys": {
              "description": "The question keys this record answers; their skipped or 'not sure' states are cleared.",
              "items": {
                "maxLength": 100,
                "type": "string"
              },
              "maxLength": 20,
              "type": "array"
            },
            "requestKey": {
              "description": "Idempotency key chosen by the client; a replay with the same key and input returns the first result.",
              "maxLength": 64,
              "minLength": 1,
              "pattern": "^[A-Za-z0-9._:-]+$",
              "type": "string"
            },
            "rkey": {
              "format": "record-key",
              "type": "string"
            },
            "slot": {
              "description": "The parent slot, 1 or 2.",
              "maximum": 2,
              "minimum": 1,
              "type": "integer"
            }
          },
          "required": [
            "homeId",
            "slot",
            "collection",
            "data",
            "requestKey"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "record": {
              "ref": "ai.newnal.illi.mydata.defs#recordView",
              "type": "ref"
            }
          },
          "required": [
            "record"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "ai.newnal.illi.mydata.putRecord",
  "lexicon": 1
}
