<commit_before>package registration.models

import play.api.libs.json.{Json, Reads}
import LegacyJodaFormat._

object LegacyJodaFormat {
  val DateTimePattern = "yyyy-MM-dd'T'HH:mm:ss'Z'"
  implicit val dateTimeFormat = Reads.jodaDateReads(DateTimePattern)
}

object LegacyTopic {
  val FootballTeamType = "football-team"
  val FootballMatchType = "football-match"
  val UserType = "user-type"

  val NewsstandIos = LegacyTopic(`type` = "newsstand", `name` = "newsstandIos")

  implicit val jf = Json.format[LegacyTopic]
}

case class LegacyTopic(
  `type`: String,
  name: String
) {
  def toTopicString: String = `type` + "//" + name
}

case class LegacyDevice(platform: String, udid: String, pushToken: String, buildTier: String)
object LegacyDevice {
  implicit val jf = Json.format[LegacyDevice]
}

case class LegacyPreferences(
  receiveNewsAlerts: Boolean,
  edition: String,
  teams: Option[Seq[String]],
  matches: Option[Seq[LegacyMatch]],
  topics: Option[Seq[LegacyTopic]]
) {
  def hasNewsstand: Boolean = topics.exists(_.contains(LegacyTopic.NewsstandIos))
  def withNewsstand: LegacyPreferences = {
    if (hasNewsstand)
      this
    else
      copy( topics = Option { topics.toList.flatten :+ LegacyTopic.NewsstandIos } )
  }
}
object LegacyPreferences {
  implicit val jf = Json.format[LegacyPreferences]
}

case class LegacyMatch(matchId: String, matchDate: String)
object LegacyMatch {
  implicit val jf = Json.format[LegacyMatch]
}

case class LegacyRegistration(device: LegacyDevice, preferences: LegacyPreferences)
object LegacyRegistration {
  implicit val jf = Json.format[LegacyRegistration]
}<commit_msg>LegacyMatch formatter must be defined before LegacyPreferences formatter<commit_after>package registration.models

import play.api.libs.json.{Json, Reads}
import LegacyJodaFormat._

object LegacyJodaFormat {
  val DateTimePattern = "yyyy-MM-dd'T'HH:mm:ss'Z'"
  implicit val dateTimeFormat = Reads.jodaDateReads(DateTimePattern)
}

object LegacyTopic {
  val FootballTeamType = "football-team"
  val FootballMatchType = "football-match"
  val UserType = "user-type"

  val NewsstandIos = LegacyTopic(`type` = "newsstand", `name` = "newsstandIos")

  implicit val jf = Json.format[LegacyTopic]
}

case class LegacyTopic(
  `type`: String,
  name: String
) {
  def toTopicString: String = `type` + "//" + name
}

case class LegacyDevice(platform: String, udid: String, pushToken: String, buildTier: String)
object LegacyDevice {
  implicit val jf = Json.format[LegacyDevice]
}

case class LegacyMatch(matchId: String, matchDate: String)
object LegacyMatch {
  implicit val jf = Json.format[LegacyMatch]
}

case class LegacyPreferences(
  receiveNewsAlerts: Boolean,
  edition: String,
  teams: Option[Seq[String]],
  matches: Option[Seq[LegacyMatch]],
  topics: Option[Seq[LegacyTopic]]
) {
  def hasNewsstand: Boolean = topics.exists(_.contains(LegacyTopic.NewsstandIos))
  def withNewsstand: LegacyPreferences = {
    if (hasNewsstand)
      this
    else
      copy( topics = Option { topics.toList.flatten :+ LegacyTopic.NewsstandIos } )
  }
}
object LegacyPreferences {
  implicit val jf = Json.format[LegacyPreferences]
}

case class LegacyRegistration(device: LegacyDevice, preferences: LegacyPreferences)
object LegacyRegistration {
  implicit val jf = Json.format[LegacyRegistration]
}
{'fraction_non_alphanumeric': 0.10412278061992175, 'fraction_numerical': 0.0, 'mean_word_length': 5.155555555555556, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5010745', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1041, 'n_words': 255}