import {
  Author,
  HostedByCollectedFrom,
  Journal, OARoutes,
  Organization,
  Project,
  RelationResult
} from "../result-preview/result-preview";

export interface Id {
  type: "pmid" | "doi" | "pmc" | "handle" | "openaire" | "swhid";
  value: string;
  trust: number
}

export interface Reference {
  name?: string;
  ids: Id[];
}

export interface Context {
  labelContext: string;
  idContext: string;
  labelCategory: string;
  idCategory: string;
  labelConcept: string;
  idConcept: string;
  link?: string;
  logo?: string;
}

export interface Measure {
  // /** @deprecated*/
	// downloads?: string;
  // /** @deprecated*/
	// views?: string;
  // /** @deprecated*/
	// influence?: string;
  // /** @deprecated*/
	// popularity?: string;
  // /** @deprecated*/
	// citations?: string;
  // /** @deprecated*/
	// impulse?: string;
  bip?: Metric[]
  counts?: Metric[]
  countsPerDatasource?: MetricPerDatasource[];
}

export interface MetricPerDatasource {
  datasourceId: string,
  datasourceName: string,
  views: number,
  downloads: number
}

export interface Metric {
  name: string,
  order: number,
  icon: string,
  value: any
}

export class ResultLandingInfo {
  relcanId;
  objIdentifier: string;
  // PUBLICATION, DATASET, SOFTWARE, ORP
  record;
  resultType: "publication"|"dataset"|"other"|"software";
  // PUBLICATION, DATASET, SOFTWARE, ORP, DELETED_BY_INFERENCE
  title: string;
  accessMode: string;
  authors: Author[];
  date: string;
  dateofacceptance: Date;
  embargoEndDate: Date;
  types: string[];
  identifiers: Map<string, string[]>;     //key is the classname
  languages: string[];
  countries: string[];
  description: string;
  
  hostedBy_collectedFrom: HostedByCollectedFrom[];
  
  // PUBLICATION, DATASET, SOFTWARE, ORP
  fundedByProjects: Project[];
  
  underCurationMessage: boolean;
  publisher: string;
  journal: Journal;
  
  subjects: string[];
  otherSubjects: Map<string, string[]>;
  classifiedSubjects: Map<string, string[]>;          //<class of subject, subjects>
  fos: {"id": string, "label": string}[] = [];
  sdg: string[];
  eoscSubjects: any[];

  oaRoutes: OARoutes;
  publiclyFunded: boolean;
  
  // // percentage is for trust
  // relatedResearchResults: RelationResult[];
  // // percentage is for similarity
  // similarResearchResults: RelationResult[];
  // //isSupplementedBy
  // supplementaryResearchResults: RelationResult[];
  // //isSupplementTo
  // supplementedByResearchResults: RelationResult[];
  //
  // // IsPartOf
  // parentResearchResults: RelationResult[];
  // // HasPart
  // childrenResearchResults: RelationResult[];
  // // Reviews
  // reviewedByResearchResults: RelationResult[];
  // // IsReviewedBy
  // reviewerResearchResults: RelationResult[];
  // // References
  // referencedByResearchResults: RelationResult[];
  // // IsReferencedBy
  // refererResearchResults: RelationResult[];
  // // IsIdenticalTo
  // identicalResearchResults: RelationResult[];
  // // IsContinuedBy
  // continuatorResearchResults: RelationResult[];
  // // Continues
  // continuedByResearchResults: RelationResult[];
  // // IsDocumentedBy
  // documentaryResearchResults: RelationResult[];
  // // Documents
  // documentedByResearchResults: RelationResult[];
  // // IsCompiledBy
  // compilerResearchResults: RelationResult[];
  // // Compiles
  // compiledByResearchResults: RelationResult[];
  // // IsPreviousVersionOf
  // newerResearchResults: RelationResult[];
  // // IsNewVersionOf
  // previousResearchResults: RelationResult[];
  // // IsVersionOf
  // versionedByResearchResults: RelationResult[];
  // // HasVersion
  // isVersionResearchResults: RelationResult[];
  // // IsSourceOf
  // derivedResearchResults: RelationResult[];
  // // IsDerivedFrom
  // sourceResearchResults: RelationResult[];
  // // IsVariantFormOf
  // originalResearchResults: RelationResult[];
  // // IsOriginalFormOf
  // variantResearchResults: RelationResult[];
  // // IsObsoletedBy
  // obsoleteResearchResults: RelationResult[];
  // // Obsolete
  // obsoletedByResearchResults: RelationResult[];

  relatedResults: RelationResult[];
  relatedClassFilters: Set<string> = new Set();

  contexts: Context[];
  
  deletedByInferenceIds: string[];
  
  // PUBLICATION, DATASET, ORP
  references: Reference[];
  
  // PUBLICATION
  bioentities: Map<string, Map<string, string>>;      //<site name, <>>
  organizations: Organization[];
  openCitations: { "url": string, "title": string, "year": string, "doi": string, "authors": string[] }[];
  
  // DATASET
  subtitle: string;
  
  // SOFTWARE
  programmingLanguages: string[];

	measure: Measure;
}
