package fr.natan.akkastreamfileprocessingapi.models import play.api.libs.json.{JsValue, Json, Writes} object Models { final case class Person( personID: String, primaryName: String, birthYear: String, deathYear: String, primaryProfession: List[String], knownForTitles: List[String] ) { implicit val personFormat = new Writes[Person] { override def writes(person: Person): JsValue = Json.obj( "person id" -> person.personID, "primary name" -> person.primaryName, "birth year" -> person.birthYear, "death year" -> person.deathYear, "primary profession" -> person.primaryProfession, "known for titles" -> person.knownForTitles ) } } final case class TvSerie( tvSerieID: String, titleType: String, primaryTitle: String, originalTitle: String, startYear: String, endYear: String, runtimeMinutes: String, genres: List[String] ) { implicit val tvSerieFormat = new Writes[TvSerie] { override def writes(tvSerie: TvSerie): JsValue = Json.obj( "tv serie id" -> tvSerie.tvSerieID, "tv serie type" -> tvSerie.titleType, "primary title" -> tvSerie.primaryTitle, "original title" -> tvSerie.originalTitle, "start year" -> tvSerie.startYear, "end year" -> tvSerie.endYear, "runtime minutes" -> tvSerie.runtimeMinutes, "genres" -> tvSerie.genres ) } } }