aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordMetaGen.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordMetaGen.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordMetaGen.scala63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordMetaGen.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordMetaGen.scala
new file mode 100644
index 0000000..1536c65
--- /dev/null
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/MedicalRecordMetaGen.scala
@@ -0,0 +1,63 @@
+package xyz.driver.pdsuidomain.fakes.entities.rep
+
+import xyz.driver.pdsuidomain.entities.MedicalRecord
+import xyz.driver.core.generators
+import xyz.driver.core.generators._
+
+object MedicalRecordMetaGen {
+ private val maxItemsInCollectionNumber = 50
+ private val pageMaxNumber = 1000
+
+ private val medicalRecordMetas = {
+ Set(
+ () => nextMedicalRecordMetaReorder,
+ () => nextMedicalRecordMetaDuplicate,
+ () => nextMedicalRecordMetaRotation
+ )
+ }
+
+
+ def nextMedicalRecordMetaReorder: MedicalRecord.Meta.Reorder = {
+ val itemsNumber =
+ maxItemsInCollectionNumber
+ val items = scala.util.Random
+ .shuffle(Seq.tabulate(itemsNumber)(identity))
+
+ MedicalRecord.Meta.Reorder(
+ predicted = nextOption(nextBoolean),
+ items = items
+ )
+ }
+
+
+ def nextMedicalRecordMetaDuplicate: MedicalRecord.Meta.Duplicate = {
+ val startPageGen =
+ nextInt(pageMaxNumber, minValue = 0)
+ val endPageGen =
+ nextInt(pageMaxNumber, startPageGen)
+
+ MedicalRecord.Meta.Duplicate(
+ predicted = nextOption(nextBoolean),
+ startPage = startPageGen.toDouble,
+ endPage = endPageGen.toDouble,
+ startOriginalPage = startPageGen.toDouble,
+ endOriginalPage = nextOption(endPageGen.toDouble)
+ )
+ }
+
+ def nextMedicalRecordMetaRotation: MedicalRecord.Meta.Rotation = {
+ val items =
+ Array.tabulate(maxItemsInCollectionNumber)(
+ index => nextString() -> index
+ ).toMap
+
+ MedicalRecord.Meta.Rotation(
+ predicted = nextOption(nextBoolean()),
+ items = items
+ )
+ }
+
+ def nextMedicalRecordMeta: MedicalRecord.Meta = {
+ generators.oneOf(medicalRecordMetas)()
+ }
+}