from .lab_iat_schema import LAB_IAT_SCHEMA
import copy

LAB_IAT_GRAPH_SCHEMA = copy.deepcopy(LAB_IAT_SCHEMA)

# Enforce number of vertices
LAB_IAT_GRAPH_SCHEMA["properties"]["annotations"]["items"]["properties"]["polygons"]["items"]["properties"]["geometry"]["properties"]["vertices"] =  { "$ref" : "iat#/$defs/graph_vertices" }

# Enforce geometry type
LAB_IAT_GRAPH_SCHEMA["properties"]["annotations"]["items"]["properties"]["polygons"]["items"]["properties"]["geometry"]["properties"]["type"] = { "const" : "graph" }
LAB_IAT_GRAPH_SCHEMA["properties"]["annotations"]["items"]["properties"]["polygons"]["items"]["properties"]["geometry"]["properties"]["edges"] = { 
    "type": "array",
    "items": {
        "type" : "array",
        "prefixItems": [
            { "type" : "number" },
            { "type" : "number" }
        ]
    }
}
LAB_IAT_GRAPH_SCHEMA["properties"]["annotations"]["items"]["properties"]["polygons"]["items"]["properties"]["geometry"]["required"] = ["vertices", "type", "edges"]