{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://granntvisten.se/data/guider.schema.json",
 "title": "Granntvisten – guider och brevmallar",
 "description": "Öppet, bara läsande flöde med Granntvistens guider om grannkonflikter och brevmallar. Allmän information med lagrum och källa, inte juridisk rådgivning. Inga personuppgifter.",
 "type": "object",
 "required": ["sajt", "url", "beskrivning", "utgivare", "genererad", "ansvarsfriskrivning", "guider", "brevmallar"],
 "properties": {
  "$schema": {"type": "string"},
  "sajt": {"type": "string"},
  "url": {"type": "string", "pattern": "^https://"},
  "beskrivning": {"type": "string"},
  "utgivare": {"type": "string", "description": "Utgivare och organisationsnummer"},
  "genererad": {"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"},
  "ansvarsfriskrivning": {"type": "string"},
  "ordning": {"type": "string", "description": "Hur listorna är ordnade"},
  "guider": {
   "type": "array",
   "items": {
    "type": "object",
    "required": ["id", "titel", "url", "kort_svar", "lagrum", "steg", "kallor", "kontrollerad"],
    "properties": {
     "id": {"type": "string", "pattern": "^[a-z0-9-]+$"},
     "titel": {"type": "string"},
     "url": {"type": "string", "pattern": "^https://"},
     "beskrivning": {"type": "string"},
     "kort_svar": {"type": "string", "description": "Kort, allmänt svar på frågan guiden finns för"},
     "lagrum": {
      "type": "array",
      "items": {
       "type": "object",
       "required": ["lagrum", "text", "url"],
       "properties": {
        "lagrum": {"type": "string", "description": "T.ex. 3 kap. 2 § jordabalken"},
        "text": {"type": "string", "description": "Sammanfattning med egna ord"},
        "url": {"type": "string", "pattern": "^https://", "description": "Länk till lagtexten"}
       }
      }
     },
     "steg": {"type": "array", "items": {"type": "object", "required": ["rubrik", "text"], "properties": {"rubrik": {"type": "string"}, "text": {"type": "string"}}}},
     "kontakter": {"type": "array", "items": {"type": "object", "required": ["namn", "nar"], "properties": {"namn": {"type": "string"}, "nar": {"type": "string"}, "url": {"type": "string", "pattern": "^https://"}}}},
     "fragor": {"type": "array", "items": {"type": "object", "required": ["fraga", "svar"], "properties": {"fraga": {"type": "string"}, "svar": {"type": "string"}}}},
     "brevmall": {"type": ["string", "null"], "description": "Adress till brevmallen som hör till ämnet, eller null"},
     "kallor": {"type": "array", "items": {"type": "string", "pattern": "^https://"}},
     "kontrollerad": {"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$", "description": "Datum då lagtexten senast kontrollerades"}
    }
   }
  },
  "brevmallar": {
   "type": "array",
   "items": {
    "type": "object",
    "required": ["id", "namn", "url", "lagrum", "kalla", "kontrollerad"],
    "properties": {
     "id": {"type": "string", "pattern": "^[a-z0-9-]+$"},
     "namn": {"type": "string"},
     "url": {"type": "string", "pattern": "^https://"},
     "beskrivning": {"type": "string"},
     "lagrum": {"type": "array", "items": {"type": "string"}},
     "kalla": {"type": "string", "pattern": "^https://"},
     "kontrollerad": {"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"},
     "guider": {"type": "array", "items": {"type": "string", "pattern": "^https://"}}
    }
   }
  }
 }
}
