{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://zenodo.org/schemas/records/base-v1.0.0.json",
    "title": "Zenodo Base Record Schema v1.0.0",
    "definitions": {
        "person_or_org": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "name": {
                    "description": "Full name of person or organisation. Personal name format: family, given.",
                    "type": "string"
                },
                "affiliation": {
                    "description": "Affiliation for the purpose of this specific record.",
                    "type": "string"
                },
                "familyname": {
                    "description": "Family name of person if known.",
                    "type": "string"
                },
                "givennames": {
                    "description": "Given names of person if known.",
                    "type": "string"
                },
                "gnd": {
                    "description": "Gemeinsame Normdatei identifier for creator.",
                    "type": "string"
                },
                "orcid": {
                    "description": "ORCID identifier for creator.",
                    "type": "string"
                }
            },
            "required": [
                "name"
            ]
        },
        "contributor_person_or_org": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "name": {
                    "description": "Full name of person or organisation. Personal name format: family, given.",
                    "type": "string"
                },
                "affiliation": {
                    "description": "Affiliation for the purpose of this specific record.",
                    "type": "string"
                },
                "familyname": {
                    "description": "Family name of person if known.",
                    "type": "string"
                },
                "givennames": {
                    "description": "Given names of person if known.",
                    "type": "string"
                },
                "gnd": {
                    "description": "Gemeinsame Normdatei identifier for creator.",
                    "type": "string"
                },
                "orcid": {
                    "description": "ORCID identifier for creator.",
                    "type": "string"
                },
                "type": {
                    "type": "string",
                    "enum": [
                        "ContactPerson",
                        "DataCollector",
                        "DataCurator",
                        "DataManager",
                        "Distributor",
                        "Editor",
                        "HostingInstitution",
                        "Other",
                        "Producer",
                        "ProjectLeader",
                        "ProjectManager",
                        "ProjectMember",
                        "RegistrationAgency",
                        "RegistrationAuthority",
                        "RelatedPerson",
                        "Researcher",
                        "ResearchGroup",
                        "RightsHolder",
                        "Sponsor",
                        "Supervisor",
                        "WorkPackageLeader"
                    ]
                }
            },
            "required": [
                "name",
                "type"
            ]
        },
        "scheme": {
            "description": "Persistent identifier scheme.",
            "type": "string",
            "enum": [
                "ads",
                "ark",
                "arxiv",
                "bioproject",
                "biosample",
                "doi",
                "ean13",
                "ean8",
                "ensembl",
                "genome",
                "gnd",
                "hal",
                "handle",
                "isbn",
                "isni",
                "issn",
                "istc",
                "lsid",
                "orcid",
                "pmcid",
                "pmid",
                "purl",
                "refseq",
                "sra",
                "uniprot",
                "url",
                "urn",
                "swh",
                "ascl"
            ]
        },
        "relation": {
            "description": "Relation type.",
            "type": "string",
            "enum": [
                "isCitedBy",
                "cites",
                "isSupplementTo",
                "isSupplementedBy",
                "isContinuedBy",
                "continues",
                "hasMetadata",
                "isMetadataFor",
                "isNewVersionOf",
                "isPreviousVersionOf",
                "isPartOf",
                "hasPart",
                "isReferencedBy",
                "references",
                "isDocumentedBy",
                "documents",
                "isCompiledBy",
                "compiles",
                "isVariantFormOf",
                "isOrignialFormOf",
                "isIdenticalTo",
                "isReviewedBy",
                "reviews",
                "isDerivedFrom",
                "isSourceOf"
            ]
        }
    },
    "type": "object",
    "properties": {
        "$schema": {
            "type": "string"
        },
        "recid": {
            "description": "Invenio record identifier (integer).",
            "type": "number"
        },
        "conceptrecid": {
            "description": "Invenio record identifier (integer).",
            "type": "string"
        },
        "doi": {
            "description": "Digital Object Identifier (DOI).",
            "type": "string"
        },
        "conceptdoi": {
            "description": "Digital Object Identifier (DOI).",
            "type": "string"
        },
        "resource_type": {
            "description": "Record resource type.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "type": {
                    "description": "General resource type.",
                    "default": "publication",
                    "type": "string"
                },
                "subtype": {
                    "description": "Specific resource type.",
                    "type": "string"
                },
                "openaire_subtype": {
                    "description": "OpenAIRE-specific resource type.",
                    "type": "string"
                }
            },
            "required": [
                "type"
            ]
        },
        "publication_date": {
            "description": "Record publication date (IS8601-formatted). EDTF support to be added for field.",
            "type": "string"
        },
        "title": {
            "description": "Record title.",
            "type": "string"
        },
        "creators": {
            "description": "Creators of record in order of importance.",
            "type": "array",
            "items": {
                "$ref": "#/definitions/person_or_org"
            }
        },
        "dates": {
            "description": "Date interval.",
            "items": {
                "additionalProperties": false,
                "properties": {
                    "start": {
                        "description": "Start date.",
                        "type": "string"
                    },
                    "end": {
                        "description": "End date.",
                        "type": "string"
                    },
                    "type": {
                        "description": "Type of the date interval.",
                        "enum": [
                            "Collected",
                            "Valid",
                            "Withdrawn"
                        ]
                    },
                    "description": {
                        "description": "Description of the date interval.",
                        "type": "string"
                    }
                },
                "required": [
                    "type"
                ],
                "type": "object"
            },
            "type": "array"
        },
        "description": {
            "description": "Description/abstract for record.",
            "type": "string"
        },
        "keywords": {
            "title": "Keywords",
            "description": "Free text keywords.",
            "type": "array",
            "items": {
                "title": "Keyword",
                "type": "string"
            }
        },
        "locations": {
            "description": "Geographical location.",
            "items": {
                "properties": {
                    "lat": {
                        "description": "Latitude of the location.",
                        "type": "number"
                    },
                    "lon": {
                        "description": "Longitude of the location.",
                        "type": "number"
                    },
                    "place": {
                        "description": "Description of the location",
                        "type": "string"
                    },
                    "description": {
                        "description": "Place of the location",
                        "type": "string"
                    }
                },
                "required": [
                    "place"
                ],
                "type": "object"
            },
            "type": "array"
        },
        "subjects": {
            "description": "Subjects from specific vocabularies.",
            "type": "array",
            "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "term": {
                        "description": "Subject term value.",
                        "type": "string"
                    },
                    "identifier": {
                        "description": "Subjects term identifier.",
                        "type": "string"
                    },
                    "scheme": {
                        "description": "Identifier scheme.",
                        "type": "string"
                    }
                }
            }
        },
        "notes": {
            "title": "Additional notes",
            "description": "Additional notes for record.",
            "type": "string"
        },
        "language": {
            "description": "ISO 639-3 language code.",
            "type": "string"
        },
        "access_right": {
            "description": "Access right for record.",
            "type": "string",
            "default": "open",
            "enum": [
                "open",
                "embargoed",
                "restricted",
                "closed"
            ]
        },
        "embargo_date": {
            "title": "Embargo Date",
            "description": "Embargo date of record (ISO8601 formatted date).",
            "type": "string"
        },
        "access_conditions": {
            "title": "Access conditions",
            "description": "Conditions under which access is given if record is restricted.",
            "type": "string"
        },
        "license": {
            "title": "License",
            "description": "License for embargoed/open access content.",
            "type": "object"
        },
        "communities": {
            "description": "List of community identifiers.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "grants": {
            "description": "Source of grants/awards which have funded all or part of this particular record.",
            "type": "array",
            "items": {
                "title": "Grant",
                "type": "object"
            }
        },
        "related_identifiers": {
            "description": "Related research outputs.",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "identifier": {
                        "description": "Identifier of research output.",
                        "type": "string"
                    },
                    "relation": {
                        "$ref": "#/definitions/relation"
                    },
                    "scheme": {
                        "$ref": "#/definitions/scheme"
                    },
                    "resource_type": {
                        "additionalProperties": false,
                        "description": "Record resource type.",
                        "properties": {
                            "subtype": {
                                "description": "Specific resource type.",
                                "type": "string"
                            },
                            "type": {
                                "default": "publication",
                                "description": "General resource type.",
                                "type": "string"
                            }
                        },
                        "type": "object"
                    }
                },
                "required": [
                    "identifier",
                    "relation",
                    "scheme"
                ]
            }
        },
        "alternate_identifiers": {
            "description": "Alternate identifiers for record.",
            "type": "array",
            "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "identifier": {
                        "description": "Identifier of research output.",
                        "type": "string"
                    },
                    "scheme": {
                        "$ref": "#/definitions/scheme"
                    },
                    "resource_type": {
                        "additionalProperties": false,
                        "description": "Record resource type.",
                        "properties": {
                            "subtype": {
                                "description": "Specific resource type.",
                                "type": "string"
                            },
                            "type": {
                                "default": "publication",
                                "description": "General resource type.",
                                "type": "string"
                            }
                        },
                        "type": "object"
                    }
                },
                "required": [
                    "identifier",
                    "scheme"
                ]
            }
        },
        "contributors": {
            "title": "Contributors",
            "description": "Contributors in order of importance.",
            "type": "array",
            "items": {
                "$ref": "#/definitions/contributor_person_or_org"
            }
        },
        "references": {
            "description": "Raw textual references when identifier is not known.",
            "type": "array",
            "items": {
                "title": "Reference",
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "raw_reference": {
                        "type": "string"
                    }
                }
            }
        },
        "journal": {
            "description": "Journal in which this record is published.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "issue": {
                    "title": "Journal issue",
                    "description": "Journal issue.",
                    "type": "string"
                },
                "pages": {
                    "title": "Journal page(s)",
                    "description": "Journal page(s).",
                    "type": "string"
                },
                "volume": {
                    "title": "Journal volume",
                    "description": "Journal volume.",
                    "type": "string"
                },
                "title": {
                    "title": "Journal title",
                    "description": "Journal title.",
                    "type": "string"
                },
                "year": {
                    "title": "Journal year",
                    "description": "Journal year.",
                    "type": "string"
                }
            }
        },
        "version": {
            "description": "Record version tag.",
            "type": "string"
        },
        "meeting": {
            "description": "Associated meeting.",
            "type": "object",
            "properties": {
                "acronym": {
                    "title": "Acronym",
                    "type": "string"
                },
                "title": {
                    "title": "Title",
                    "type": "string"
                },
                "place": {
                    "title": "Place",
                    "type": "string"
                },
                "dates": {
                    "title": "Dates",
                    "type": "string"
                },
                "session": {
                    "title": "Session",
                    "type": "string"
                },
                "session_part": {
                    "title": "Part of session",
                    "type": "string"
                },
                "url": {
                    "title": "URL",
                    "type": "string"
                }
            }
        },
        "part_of": {
            "description": "For parts of books and reports.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "title": {
                    "title": "Title",
                    "type": "string"
                },
                "pages": {
                    "title": "Pages",
                    "type": "string"
                }
            }
        },
        "imprint": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "publisher": {
                    "type": "string"
                },
                "place": {
                    "type": "string"
                },
                "isbn": {
                    "type": "string"
                }
            }
        },
        "thesis": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "university": {
                    "description": "Awarding university in case of a thesis.",
                    "type": "string"
                },
                "supervisors": {
                    "description": "Supervisors of thesis in order of importance.",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/person_or_org"
                    }
                }
            }
        },
        "owners": {
            "description": "List of user ids that are record as owner of record.",
            "type": "array",
            "items": {
                "type": "number"
            }
        },
        "method": {
            "description": "Information about the used Method",
            "type": "string"
        },
        "_oai": {
            "description": "OAI-PMH specific information.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "id": {
                    "description": "OAI-PMH record identifier.",
                    "type": "string"
                },
                "sets": {
                    "description": "OAI-PMH sets for record.",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "updated": {
                    "description": "Last OAI-PMH set update (ISO8601 formatted timestamp)",
                    "type": "string"
                }
            }
        },
        "custom": {
            "type": "object",
            "additionalProperties": {
                "type": "array",
                "items": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "type": "number"
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                                "subject": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                },
                                "object": {
                                    "type": "array",
                                    "items": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    ]
                }
            },
            "description": "Custom metadata"
        },
        "_internal": {
            "description": "Metadata for internal use only.",
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "comments": {
                    "description": "Comments for internal purposes.",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                            "timestamp": {
                                "description": "ISO8601 formatted date time stamp.",
                                "type": "string"
                            },
                            "user_id": {
                                "description": "User making the comment.",
                                "type": "string"
                            },
                            "comment": {
                                "description": "Comment.",
                                "type": "string"
                            }
                        },
                        "required": [
                            "timestamp",
                            "user_id",
                            "comment"
                        ]
                    }
                },
                "source": {
                    "description": "Information related to initial source of acquisition.",
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "legacy_deposit_id": {
                            "anyOf": [
                                {
                                    "type": "string"
                                },
                                {
                                    "type": "null"
                                }
                            ]
                        },
                        "agents": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                    "role": {
                                        "type": "string",
                                        "enum": [
                                            "uploader"
                                        ]
                                    },
                                    "name": {
                                        "type": "string"
                                    },
                                    "email": {
                                        "type": "string"
                                    },
                                    "username": {
                                        "type": "string"
                                    },
                                    "user_id": {
                                        "anyOf": [
                                            {
                                                "type": "string"
                                            },
                                            {
                                                "type": "null"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}