From 51f5b5bf023600118121dfed9c2f65c4fceb1c68 Mon Sep 17 00:00:00 2001
From: Alexander Schlemmer <alexander@mail-schlemmer.de>
Date: Fri, 18 Feb 2022 12:02:34 +0100
Subject: [PATCH] ENH: new data classes for storing parent and property data

---
 src/caosdb/high_level_api.py | 49 ++++++++++++++++++++++++------------
 1 file changed, 33 insertions(+), 16 deletions(-)

diff --git a/src/caosdb/high_level_api.py b/src/caosdb/high_level_api.py
index fed8b786..21e0b19a 100644
--- a/src/caosdb/high_level_api.py
+++ b/src/caosdb/high_level_api.py
@@ -38,6 +38,39 @@ from .apiutils import get_type_of_entity_with
 
 from typing import Any, Optional
 
+from dataclasses import dataclass
+
+@dataclass
+class CaosDBPropertyMetaData:
+    # name is already the name of the attribute
+    unit: Optional[str] = None
+    datatype: Optional[str] = None
+    file: Optional[str] = None
+    path: Optional[str] = None
+    description: Optional[str] = None
+    id: Optional[int] = None
+    importance: Optional[str] = None
+    
+
+@dataclass
+class CaosDBPythonUnresolvedParent:
+    """
+    Parents can be either given by name or by ID.
+
+    When resolved, both fields should be set.
+    """
+
+    id: Optional[int] = None
+    name: Optional[str] = None
+
+
+@dataclass
+class CaosDBPythonUnresolvedReference:
+
+    def __init__(self, id=None):
+        self.id = id
+
+
 class CaosDBPythonEntity(object):
 
     _last_id = 0
@@ -323,22 +356,6 @@ class CaosDBPythonProperty(CaosDBPythonEntity):
     pass
 
 
-class CaosDBPythonParent(object):
-    """
-    Parents can be either given by name or by ID.
-
-    When resolved, both fields should be set.
-    """
-
-    def __init__(self, id=None, name=None):
-        self.id = id
-        self.name = name
-
-
-class CaosDBPythonUnresolvedReference(object):
-
-    def __init__(self, id=None):
-        self.id = id
 
 
 class CaosDBPythonFile(CaosDBPythonEntity):
-- 
GitLab