aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/BridgeUploadQueueGen.scala
blob: fb1d3e3fa23846dbcc4193656d688a45669b3f75 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package xyz.driver.pdsuidomain.fakes.entities.rep

import xyz.driver.core.generators.{nextBoolean, nextInt, nextOption, nextString}
import xyz.driver.pdsuicommon.concurrent.BridgeUploadQueue
import xyz.driver.pdsuidomain.entities.ProviderType
import xyz.driver.pdsuidomain.fakes.entities.common.{nextLocalDateTime, nextLongId}

object BridgeUploadQueueGen {
  private val maxAttemtsNumber = 100

  def nextBridgeUploadQueueItem(): BridgeUploadQueue.Item = {
    BridgeUploadQueue.Item(
      kind = nextString(),
      tag = nextString(),
      created = nextLocalDateTime,
      attempts = nextInt(maxAttemtsNumber, minValue = 0),
      nextAttempt = nextLocalDateTime,
      completed = nextBoolean(),
      dependencyKind = nextOption(nextString()),
      dependencyTag = nextOption(nextString())
    )
  }

  def nextProviderType(): ProviderType = {
    ProviderType(
      id = nextLongId[ProviderType],
      name = nextString()
    )
  }

}