{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "A Submittable Schema",
    "description": "Submittable base schema",
    "type": "object",
    "properties": {
        "alias": {
            "description": "An unique identifier in a submission.",
            "type": "string",
            "minLength": 1
        },
        "title": {
            "description": "Title of the submittable.",
            "type": "string"
        },
        "description": {
            "description": "More extensive free-form description.",
            "type": "string"
        },
        "attributes": {
            "$ref": "#/definitions/attributes"
        },
        "studyRef": {
            "description": "Reference to study.",
            "$ref": "#/definitions/submittableRef"
        },
        "protocolUses": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "protocolRef": {
                        "$ref": "#/definitions/submittableRef"
                    },
                    "attributes": {
                        "$ref": "#/definitions/attributes"
                    }
                }
            }
        },
        "sampleUses": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "sampleRef": {
                        "$ref": "#/definitions/submittableRef"
                    },
                    "attributes": {
                        "$ref": "#/definitions/attributes"
                    }
                }
            }
        }
    },
    "definitions": {
        "attributes": {
            "description": "Attributes for describing a submittable.",
            "type": "object",
            "properties": {},
            "patternProperties": {
                "^.*$": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "properties": {
                            "value": {
                                "type": "string",
                                "minLength": 1
                            },
                            "units": {
                                "type": "string",
                                "minLength": 1
                            },
                            "terms": {
                                "type": "array",
                                "items": {
                                    "type": "object",
                                    "properties": {
                                        "url": {
                                            "type": "string",
                                            "format": "uri"
                                        }
                                    },
                                    "required": [
                                        "url"
                                    ]
                                }
                            }
                        },
                        "required": [
                            "value"
                        ]
                    }
                }
            }
        },
        "submittableRef": {
            "type": "object",
            "properties": {
                "alias": {
                    "type": "string",
                    "minLength": 1
                },
                "accession": {
                    "type": "string",
                    "minLength": 1
                },
                "team": {
                    "type": "string",
                    "minLength": 1
                }
            },
            "oneOf": [
                {
                    "required": [
                        "alias",
                        "team"
                    ]
                },
                {
                    "required": [
                        "accession"
                    ]
                }
            ]
        }
    },
    "required": [
        "alias"
    ]
}