{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "definitions": {
        "schema_version": {
            "description": "The version of this schema is ...",
            "pattern": "^0.0.3$",
            "type": "string"
        },
        "time_stamp": {
            "_format": "date-time",
            "description": "ISO 8601 / RFC 3339",
            "type": "string"
        },
        "uuid": {
            "description": "uuid with all lower case or all upper case characters",
            "oneOf": [
                {
                    "description": "lower case",
                    "pattern": "^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$"
                },
                {
                    "description": "upper case",
                    "pattern": "^[0-9A-F]{8}-([0-9A-F]{4}-){3}[0-9A-F]{12}$"
                }
            ],
            "type": "string"
        }
    },
    "description": "This is UCSC Genomics Core's schema for an analysis workflow's metadata record. It is based on the schema defined in metadata_schema.json.",
    "properties": {
        "analysis_type": {
            "description": "The analysis type needs to be tightly controlled because it is used in the metadata merging script to assign flags.",
            "enum": [
                "sequence_upload",
                "alignment",
                "rna_seq_quantification",
                "germline_variant_calling",
                "somatic_variant_calling",
                "immuno_target_pipelines"
            ]
        },
        "bundle_uuid": {
            "$ref": "#/definitions/uuid"
        },
        "parent_uuids": {
            "description": "parent UUIDs for this workflow",
            "items": {
                "$ref": "#/definitions/uuid"
            },
            "type": "array"
        },
        "timestamp": {
            "$ref": "#/definitions/time_stamp",
            "description": "We want this time stamp in detached analysis data, but not required when uploading via upload tool."
        },
        "workflow_name": {
            "type": "string"
        },
        "workflow_outputs": {
            "items": {
                "properties": {
                    "file_path": {
                        "type": "string"
                    },
                    "file_type": {
                        "type": "string"
                    },
                    "file_uuid": {
                        "$ref": "#/definitions/uuid"
                    }
                },
                "required": [
                    "file_path",
                    "file_type"
                ],
                "type": "object"
            },
            "type": "array"
        },
        "workflow_version": {
            "type": "string"
        }
    },
    "required": [
        "parent_uuids",
        "timestamp",
        "analysis_type",
        "bundle_uuid",
        "workflow_name",
        "workflow_version",
        "workflow_outputs"
    ],
    "title": "analysis_schema",
    "type": "object"
}