aboutsummaryrefslogblamecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/rep/BridgeUploadQueueGen.scala
blob: fb1d3e3fa23846dbcc4193656d688a45669b3f75 (plain) (tree)






























                                                                                   
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()
    )
  }

}