aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportTrialArm.scala
blob: b2b02eb00ad4705ab1743aeb8e773b258debf7d2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package xyz.driver.pdsuidomain.formats.json.export

import play.api.libs.functional.syntax._
import play.api.libs.json._
import xyz.driver.pdsuidomain.entities.export.trial.ExportTrialArm

final case class ApiExportTrialArm(armId: String, armName: String)

object ApiExportTrialArm {

  implicit val format: Format[ApiExportTrialArm] = (
    (JsPath \ "armId").format[String] and
      (JsPath \ "armName").format[String]
  )(ApiExportTrialArm.apply, unlift(ApiExportTrialArm.unapply))

  def fromDomain(arm: ExportTrialArm) = ApiExportTrialArm(
    armId = arm.armId.toString,
    armName = arm.armName
  )
}