{
    "$id": "https://guaix.ucm.es/megara/schemas/basestruct.json",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Schema for MEGARA structured results",
    "description": "Describe MEGARA structured results",
    "oneOf": [
        {
            "$ref": "#/definitions/trace_map"
        },
        {
            "$ref": "#/definitions/model_map"
        },
        {
            "$ref": "#/definitions/wave_calib"
        }
    ],
    "definitions": {
        "trace_map": {
            "allOf": [
                {
                    "$ref": "#/definitions/base_struct"
                },
                {
                    "type": "object",
                    "properties": {
                        "type_fqn": {
                            "type": "string",
                            "const": "megaradrp.products.tracemap.TraceMap"
                        }
                    }
                }
            ]
        },
        "model_map": {
            "allOf": [
                {
                    "$ref": "#/definitions/base_struct"
                },
                {
                    "type": "object",
                    "properties": {
                        "type_fqn": {
                            "type": "string",
                            "const": "megaradrp.products.modelmap.ModelMap"
                        }
                    }
                }
            ]
        },
        "wave_calib": {
            "allOf": [
                {
                    "$ref": "#/definitions/base_struct"
                },
                {
                    "type": "object",
                    "properties": {
                        "type_fqn": {
                            "type": "string",
                            "const": "megaradrp.products.wavecalibration.WavelengthCalibration"
                        }
                    }
                }
            ]
        },
        "base_struct": {
            "type": "object",
            "properties": {
                "instrument": {
                    "type": "string"
                },
                "uuid": {
                    "$ref": "#/definitions/uuid"
                },
                "type": {
                    "type": "string"
                },
                "type_fqn": {
                    "type": "string"
                },
                "contents": {
                    "type": "array"
                },
                "quality_control": {
                    "type": "string"
                },
                "tags": {
                    "type": "object"
                },
                "meta_info": {
                    "$ref": "#/definitions/meta_info"
                }
            },
            "required": [
                "instrument",
                "type_fqn"
            ]
        },
        "meta_info": {
            "type": "object"
        },
        "uuid": {
            "type": "string",
            "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
        },
        "datetime": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,4})?$"
        }
    }
}