{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "schema/towns",
  "title": "Town",
  "description": "A town belonging to a nation from apXtrib world",
  "type": "object",
  "properties": {
    "townId": {
      "type": "string",
      "pattern": "^[a-z0-9]*$"
    },
    "nationId": {
      "type": "string",
      "$apxenumkey": "nationchains/nations/idx/lst_nationd.json"
    },
    "owner":{
      "type": "string",
      "$apxenumkey": "nationchains/pagans/idx/lst_alias.json"
    },
    "mayorId": {
      "comment":"todo, to be remove by ower in models",
      "type": "string",
      "$apxenumkey": "nationchains/pagans/idx/lst_alias.json"
    },
    "status": {
      "default": "active",
      "type": "string",
      "enum":["chain","unchain","tochain"]
    },
    "dns": {
      "type": "string"
    }
  },
  "required": ["townId", "status", "nationId", "dns"],
  "apxid":"townId",
  "apxuniquekey": ["townId","dns"],
  "apxidx": [
    { "name":"lst_townId", "keyval": "townId" },
    { "name":"all_townId", "keyval": "townId" },
    { "name":"dns_townId", "keyval": "dns","objkey":["townId"] },
    { "name":"mayorId_townId", "keyval": "mayorId","objkey":["townId"]  }
  ],
  "apxaccessrights":{
    "pagan":{"C":[],"R":[]},
    "owner":{"D":[], "U":["owner","status"]}
  }
}