From 0f1b37579e8e850cf8005957c253beadebd0411f Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Tue, 15 Aug 2023 10:23:38 +0200
Subject: [PATCH] Use common schemas

---
 .../tmss/tmssapp/adapters/l2stationspecs.py   | 83 +++----------------
 1 file changed, 10 insertions(+), 73 deletions(-)

diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/adapters/l2stationspecs.py b/SAS/TMSS/backend/src/tmss/tmssapp/adapters/l2stationspecs.py
index 40ca93d391f..4a473b078cc 100644
--- a/SAS/TMSS/backend/src/tmss/tmssapp/adapters/l2stationspecs.py
+++ b/SAS/TMSS/backend/src/tmss/tmssapp/adapters/l2stationspecs.py
@@ -43,30 +43,19 @@ schema = """
       "minimum": 1
     },
     "start_time": {
-      "type": "string",
-      "format": "date-time",
-      "default": "1970-01-01T00:00:00"
+      "$ref": "https://tmss.lofar.eu/api/schemas/commonschematemplate/datetime/10#/definitions/timestamp"
     },
     "stop_time": {
-      "type": "string",
-      "format": "date-time"
+      "$ref": "https://tmss.lofar.eu/api/schemas/commonschematemplate/datetime/10#/definitions/timestamp"
     },
     "early_start_latency": {
-      "type": "number",
+      "$ref": "https://tmss.lofar.eu/api/schemas/commonschematemplate/datetime/10#/definitions/timedelta"
       "description": "Number of seconds to start before the provided start time, to account for initialising the on-line signal chain, and for possibly negative geometrical delay compensation.",
       "default": 2.0,
       "minimum": 0
     },
     "antenna_field": {
-      "default": "HBA",
-      "description": "Antenna field to use",
-      "type": "string",
-      "enum": [
-        "LBA",
-        "HBA",
-        "HBA0",
-        "HBA1"
-      ]
+      "$ref": "https://tmss.lofar.eu/api/schemas/commonschematemplate/stations/10/#/definitions/antennas/field"
     },
     "antenna_set": {
       "default": "ALL",
@@ -81,16 +70,7 @@ schema = """
       ]
     },
     "filter": {
-      "type": "string",
-      "enum": [
-        "LBA_10_90",
-        "LBA_10_70",
-        "LBA_30_90",
-        "LBA_30_70",
-        "HBA_170_230",
-        "HBA_110_190",
-        "HBA_210_250"
-      ]
+      "$ref": "https://tmss.lofar.eu/api/schemas/commonschematemplate/stations/10/#/definitions/filter"
     },
     "SAPs": {
       "type": "array",
@@ -107,69 +87,26 @@ schema = """
                 "type": "array",
                 "minItems": 1,
                 "items": {
-                  "type": "number"
+                  "type": "number",
+                  "minimum": 0,
+                  "maximum": 511
                 }
               },
               "pointing": {
-                "$ref": "#/definitions/pointing"
+                "$ref": "https://tmss.lofar.eu/api/schemas/commonschematemplate/pointing/9#/definitions/pointing"
               }
             }
         }
       }
     },
     "tile_beam": {
-      "$ref": "#/definitions/pointing"
+      "$ref": "https://tmss.lofar.eu/api/schemas/commonschematemplate/pointing/9#/definitions/pointing"
     },
     "first_beamlet": {
       "type": "number",
       "default": 0,
       "minimum": 0
     }
-  },
-  "definitions": {
-    "pointing": {
-      "type": "object",
-      "required": [
-        "angle1",
-        "angle2",
-        "direction_type"
-      ],
-      "properties": {
-        "angle1": {
-          "default": 0.6624317181687094,
-          "description": "First angle (e.g. RA)",
-          "title": "Angle 1",
-          "type": "number"
-        },
-        "angle2": {
-          "default": 1.5579526427549426,
-          "description": "Second angle (e.g. DEC)",
-          "title": "Angle 2",
-          "type": "number"
-        },
-        "direction_type": {
-          "default": "J2000",
-          "description": "",
-          "enum": [
-            "J2000",
-            "AZELGEO",
-            "LMN",
-            "SUN",
-            "MOON",
-            "MERCURY",
-            "VENUS",
-            "MARS",
-            "JUPITER",
-            "SATURN",
-            "URANUS",
-            "NEPTUNE",
-            "PLUTO"
-          ],
-          "title": "Reference frame",
-          "type": "string"
-        }
-      }
-    }
   }
 }
 """
-- 
GitLab