package eu.dnetlib.data.proto;

import "FieldType.proto";

option java_package = "eu.dnetlib.data.proto";
option java_outer_classname = "ResultProtos";

message Result {

	optional Metadata metadata = 2;
	
	repeated Instance instance = 6;
	
	repeated ExternalReference externalReference = 7;

	message Metadata {

		repeated Author author = 40;

		// resulttype allows subclassing results into publications | datasets | software
		optional Qualifier resulttype = 8;

		// common fields
		optional Qualifier language = 12;
		repeated Qualifier country = 33;

		repeated StructuredProperty subject = 1;
		repeated StructuredProperty title = 2;
		repeated StructuredProperty relevantdate = 3;

		repeated StringField description = 25;
		optional StringField dateofacceptance = 4;
		optional StringField publisher = 5;
		optional StringField embargoenddate = 6;
		repeated StringField source = 27;
		repeated StringField fulltext = 29; // remove candidate
		repeated StringField format = 21;
		repeated StringField contributor = 30;
		optional Qualifier resourcetype = 19;
		repeated StringField coverage = 43;

		repeated Context context = 28;

		// publication specific
		optional Journal journal = 18;

		// dataset specific
		optional StringField storagedate = 9;
		optional StringField device = 26;
		optional StringField size = 20;
		optional StringField version = 22;
		optional StringField lastmetadataupdate = 23;
		optional StringField metadataversionnumber = 24;
		repeated GeoLocation geolocation = 44;

		// software specific
		repeated StringField documentationUrl = 35;
		repeated StructuredProperty license = 36;
		optional StringField codeRepositoryUrl = 38;
		optional Qualifier programmingLanguage = 39;

		// other research products specifics
		repeated StringField contactperson = 45;
		repeated StringField contactgroup = 41;
		repeated StringField tool = 42;

	}
	
	message Journal {
		optional string name = 1;
		optional string issnPrinted = 2;
		optional string issnOnline = 3;
		optional string issnLinking = 4;

		optional string ep = 6;
		optional string iss = 7;
		optional string sp = 8;
		optional string vol = 9;

		optional string edition = 10;
		optional string conferenceplace = 11;
		optional string conferencedate = 12;

		optional DataInfo dataInfo = 5;
	}
	
	// <concept id="egi::vo::alice" />
	message Context {
		required string id = 1;
		repeated DataInfo dataInfo = 2;
	}
	
	message Instance {

		optional StringField license = 6;
		optional Qualifier accessright = 3;
		optional Qualifier instancetype = 4;
	
		optional KeyValue hostedby = 5;
		repeated string url = 9;

		// other research products specific
		optional string distributionlocation = 12;

		optional KeyValue collectedfrom = 10;
		optional StringField dateofacceptance = 11;
	}
	
	message ExternalReference {
	
		optional string sitename = 1;		// source
		optional string label = 2;			// title
		optional string url = 3;			// text()
		optional string description = 4;	// ?? not mapped yet ??
		optional Qualifier qualifier = 5;	// type
		optional string refidentifier = 6;	// site internal identifier
		optional string query = 7;			// maps the oaf:reference/@query attribute
		optional DataInfo dataInfo = 8;		// ExternalReferences might be also inferred
	}

	message GeoLocation {

		optional string point = 1;
		optional string box = 2;
		optional string place = 3;
	}

}
