{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "/schema/person",
  "title": "Person minimum definition to link a person to a pagan identity",
  "description": "A person is a human with a apxtrib identity (Public Private Key. Information stored (not cipher) for a person are only visible from the town's Mayor and the tribe's Druid. You need at least trus the druid that trust the mayor (for sensitive data Mayor and Druid can be the same apx Identity.) Only a pagan that have the privateKey can read cipher data. The purpose of this sschema is to link a person to a tribe and manage basic activities, profil will be a tribe object if need more personnal information",
  "type": "object",
  "properties": {
    "alias": {
      "type": "string",
      "minLength": 5,
      "pattern": "^[a-z0-9]*$"
    },
    "owner": {
      "title": "Alias that own this object",
      "type": "string",
      "format": "Alias"
    },
    "dt_create": {
      "type": "string",
      "format": "date-time",
      "default": "dayjs.now()"
    },
    "dt_update": {
      "type": "string",
      "format": "date-time"
    },
    "dt_lastlogin": {
      "type": "string",
      "format": "date-time"
    },
    "dt_close": {
      "type": "string",
      "format": "date-time"
    },
    "recoveryauth": {
      "type": "object",
      "$ref": "schema/recoveryauth.json"
    },
    "firstname": {
      "type": "string"
    },
    "lastname": {
      "type": "string"
    },
    "dt_birth":{
      "type":"string",
      "format":"date"
    },
    "gender":{
      "type":"string",
      "enum":[ "M","MME","OTHER"]
    },
    "emailcom":{"type":"string","format":"email"},
    "biography": {
      "type": "string",
      "pattern": "^.{O,150}$"
    },
    "imgavatar": {
      "type": "string"
    },
    "accessrights": {
      "title": "Accessright per Object or per Object.key belonging to tribe",
      "description": "A Person has to exist and want to create read update delete, if Own means if owner = alias of user requested some CRUD action to owner then he can act on this object or object.key List of Object with CRUDO value like {Person:'RUDO',"Person.recoveryauth":'O',...}",
      "type": "object"
    }
  },
  "required": [
    "alias",
    "accessright"
  ],
  "apxprimarykey": "alias",
  "apxunique": [
    ""
  ],
  "apxsearchindex": [
    {
      "key": "alias",
      "value": []
    },
    {
      "key": "recovery.email",
      "value": "alias"
    }
  ]
}