From fdf885ad269f3281156d1c846f87f721036a6e2a Mon Sep 17 00:00:00 2001
From: Andreas Huber <anh@fjd.de>
Date: Mon, 6 Apr 2020 13:39:57 +0200
Subject: [PATCH] Abgleich mit Labor Wohngeld

---
 models/common/address-international.json | 10 ++-
 models/common/address-national.json      | 84 ++++++++++++++++++------
 models/common/eID-org-acting-person.json |  2 +-
 models/common/phone.json                 | 19 ++----
 models/common/phonenr.json               |  7 --
 5 files changed, 80 insertions(+), 42 deletions(-)
 delete mode 100644 models/common/phonenr.json

diff --git a/models/common/address-international.json b/models/common/address-international.json
index 9c0b91b1..69bd2b4c 100644
--- a/models/common/address-international.json
+++ b/models/common/address-international.json
@@ -20,10 +20,16 @@
     "lines": {
       "type": "array",
       "maxItems": 5,
-      "minItems": 1,
+      "minItems": 2,
+      "description": "Anschriftzeile",
       "items": {
-        "type": "string"
+        "type": "string",
+        "maxLength": 35
       }
+    },
+    "country": {
+      "type": "string",
+      "description": "Staat"
     }
   }
 }
\ No newline at end of file
diff --git a/models/common/address-national.json b/models/common/address-national.json
index 8f02ea9b..a89ec43b 100644
--- a/models/common/address-national.json
+++ b/models/common/address-national.json
@@ -1,25 +1,6 @@
 {
   "title": "National Address",
-  "type": "object",
   "description": "Eine nationale (deutsche) Adresse, bestehend aus Straße, Hausnummer, PLZ und Ort.",
-  "properties": {
-    "street": {
-      "type": "string",
-      "description": "Straße"
-    },
-    "house-number": {
-      "type": "string",
-      "description": "Hausnummer"
-    },
-    "postal-code": {
-      "type": "string",
-      "description": "PLZ"
-    },
-    "city": {
-      "type": "string",
-      "description": "Ort"
-    }
-  },
   "x-examples": {
     "example-1": {
       "street": "Kurzer Weg",
@@ -27,5 +8,68 @@
       "postal-code": "12345",
       "city": "Ankh-Morpork"
     }
-  }
+  },
+  "oneOf": [
+    {
+      "properties": {
+        "street": {
+          "type": "string",
+          "description": "Straße",
+          "maxLength": 55
+        },
+        "house-number": {
+          "type": [
+            "string",
+            "integer"
+          ],
+          "description": "Hausnummer",
+          "maxLength": 9,
+          "minimum": 1
+        },
+        "house-number-suffix": {
+          "type": "string",
+          "description": "Hausnummerzusatz",
+          "maxLength": 2,
+          "pattern": "^[\\p{L}0-9. ]*$"
+        },
+        "postal-code": {
+          "type": "string",
+          "description": "Postleitzahl",
+          "minLength": 5,
+          "maxLength": 5,
+          "pattern": "^([0]{1}[1-9]{1}|[1-9]{1}[0-9]{1})[0-9]{3}$"
+        },
+        "city": {
+          "type": "string",
+          "description": "Ort",
+          "maxLength": 50
+        },
+        "address-supplement": {
+          "type": "string",
+          "description": "Adresszusatz"
+        }
+      }
+    },
+    {
+      "properties": {
+        "post-office-box": {
+          "type": "string",
+          "description": "Postfach"
+        },
+        "postal-code": {
+          "type": "string",
+          "description": "Postleitzahl",
+          "minLength": 5,
+          "maxLength": 5,
+          "pattern": "^([0]{1}[1-9]{1}|[1-9]{1}[0-9]{1})[0-9]{3}$"
+        },
+        "city": {
+          "type": "string",
+          "description": "Ort",
+          "maxLength": 50
+        }
+      }
+    }
+  ],
+  "type": "object"
 }
\ No newline at end of file
diff --git a/models/common/eID-org-acting-person.json b/models/common/eID-org-acting-person.json
index a4ee86fe..97bd6040 100644
--- a/models/common/eID-org-acting-person.json
+++ b/models/common/eID-org-acting-person.json
@@ -29,7 +29,7 @@
       "type": "string",
       "description": "Künstler- oder Ordensname"
     },
-    "academic-title": {
+    "doctoral-degrees": {
       "type": "string",
       "description": "Akademischer Titel, z.B. \"Dr.\" oder \"Prof.\""
     },
diff --git a/models/common/phone.json b/models/common/phone.json
index d5e3e68a..5638af8e 100644
--- a/models/common/phone.json
+++ b/models/common/phone.json
@@ -1,31 +1,26 @@
 {
-  "title": "Phone",
   "type": "object",
+  "title": "Phone",
   "description": "Telefonnumer mit Zusatzinformationen",
+  "additionalProperties": false,
   "properties": {
     "number": {
       "type": "string",
       "title": "Phone Number",
+      "description": "Telefonnummer im internationalen Format, z.B. \"+49 89 32168-42\". Muss mit einem Plus beginnen und darf danach außer Ziffern nur Leerzeichen ( ) und Bindestriche (-) enthalten.",
       "example": "+49 89 32168-42",
-      "pattern": "^\\+[1-9]([ -]?[0-9]){1,14}$",
-      "description": "Telefonnummer im internationalen Format, z.B. \"+49 89 32168-42\". Muss mit einem Plus beginnen und darf danach außer Ziffern nur Leerzeichen ( ) und Bindestriche (-) enthalten."
+      "maxLength": 23
     },
     "mobile": {
       "type": "boolean",
       "description": "Zeigt an, ob es sich um eine Mobilfunknummer handelt."
     },
-    "type": {
+    "description": {
       "type": "string",
-      "enum": [
-        "work",
-        "home",
-        "other"
-      ],
-      "description": "Art der Telefonnummer: work=dienstlich, home=privat oder other=sonstige"
+      "description": "Beschreibung der Art der Telefonnummer"
     }
   },
   "required": [
-    "number",
-    "type"
+    "number"
   ]
 }
\ No newline at end of file
diff --git a/models/common/phonenr.json b/models/common/phonenr.json
deleted file mode 100644
index a32d8d00..00000000
--- a/models/common/phonenr.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "type": "string",
-  "title": "Phone Number",
-  "example": "+49 89 32168-42",
-  "pattern": "^\\+[1-9]([ -]?[0-9]){1,14}$",
-  "description": "Telefonnummer im internationalen Format, z.B. \"+49 89 32168-42\". Muss mit einem Plus beginnen und darf danach außer Ziffern nur Leerzeichen ( ) und Bindestriche (-) enthalten."
-}
\ No newline at end of file
-- 
GitLab