aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala
new file mode 100644
index 0000000..78a73a6
--- /dev/null
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala
@@ -0,0 +1,22 @@
+package xyz.driver.pdsuidomain.formats.json.export
+
+import play.api.libs.functional.syntax._
+import play.api.libs.json.{Format, JsPath}
+import xyz.driver.pdsuidomain.entities.export.patient.ExportPatientLabel
+
+final case class ApiExportPatientLabel(id: String, labelName: String, evidences: List[ApiExportPatientLabelEvidence])
+
+object ApiExportPatientLabel {
+
+ implicit val format: Format[ApiExportPatientLabel] = (
+ (JsPath \ "labelId").format[String] and
+ (JsPath \ "labelName").format[String] and
+ (JsPath \ "evidence").format[List[ApiExportPatientLabelEvidence]]
+ ) (ApiExportPatientLabel.apply, unlift(ApiExportPatientLabel.unapply))
+
+ def fromDomain(label: ExportPatientLabel) = ApiExportPatientLabel(
+ id = label.id.toString,
+ labelName = label.name,
+ evidences = label.evidences.map(ApiExportPatientLabelEvidence.fromDomain)
+ )
+}