import { Person } from 'app/shared/model/person.model';
import { SearchResultDTO } from 'app/shared/model/search/search-result-dto.model';

export enum IExerciseType {
  COLLECTION = 'collection',
  PROGRAMMING_EXERCISE = 'programming exercise',
  EXERCISE = 'exercise',
  OTHER = 'other',
}

export enum ILanguages {
  GERMAN = 'de',
  ENGLISH = 'en',
}

// just a cheap trick, to make enum available to HTML.
// see https://stackoverflow.com/questions/35835984/how-to-use-a-typescript-enum-value-in-an-angular2-ngswitch-statement
// export function IExerciseTypeAware(constructor: Function) {
//    constructor.prototype.IExerciseType = IExerciseType;
// }

// export class IExerciseTypeClass {
//     myEnum: typeof IExerciseType;
//     myEnumField: IExerciseType;
// }

export interface Exercise {
  // from metadata (required)
  title: string;
  license: string;

  // from metadata (optional)
  description: string;
  programmingLanguages: string[];
  languages: string[];
  creators: Person[];
  publisher: Person[];
  contributor: Person[];
  requires: string[];
  imageURL: string;
  timeRequired: string;
  deprecated: boolean;
  difficulty: string;
  educationLevel: string;
  format: Array<string>;
  keyword: Array<string>;
  // language: Array<string>;
  // repositoryURL: string;
  // source: Array<string>;
  status: string;
  // structure: string;
  type: IExerciseType;
  structure: string;
  version: string;
  metadataVersion: string;

  gitlabURL: string;

  // not in metadata
  rating: number;
  lastUpdate: Date;
  originalResult: SearchResultDTO;

  // thesis
  views: number;
  downloads: number;
}