package com.gu.scanamo.request

import com.amazonaws.services.dynamodbv2.model.AttributeValue
import com.gu.scanamo.EvaluationKey
import com.gu.scanamo.query.{Condition, Query}

case class ScanamoPutRequest(
    tableName: String,
    item: AttributeValue,
    condition: Option[RequestCondition]
)

case class ScanamoDeleteRequest(
    tableName: String,
    key: Map[String, AttributeValue],
    condition: Option[RequestCondition]
)

case class ScanamoUpdateRequest(
    tableName: String,
    key: Map[String, AttributeValue],
    updateExpression: String,
    attributeNames: Map[String, String],
    attributeValues: Map[String, AttributeValue],
    condition: Option[RequestCondition]
)

case class ScanamoScanRequest(
    tableName: String,
    index: Option[String],
    options: ScanamoQueryOptions
)

case class ScanamoQueryRequest(
    tableName: String,
    index: Option[String],
    query: Query[_],
    options: ScanamoQueryOptions
)

case class ScanamoQueryOptions(
    consistent: Boolean,
    scanIndexForward: Boolean,
    limit: Option[Int],
    exclusiveStartKey: Option[EvaluationKey],
    filter: Option[Condition[_]]
)
object ScanamoQueryOptions {
  val default = ScanamoQueryOptions(false, true, None, None, None)
}

case class RequestCondition(
    expression: String,
    attributeNames: Map[String, String],
    attributeValues: Option[Map[String, AttributeValue]]
)

package com.gu.scanamo.request

import com.amazonaws.services.dynamodbv2.model.AttributeValue
import com.gu.scanamo.EvaluationKey
import com.gu.scanamo.query.{Condition, Query}

case class ScanamoPutRequest(
    tableName: String,
    item: AttributeValue,
    condition: Option[RequestCondition]
)

case class ScanamoDeleteRequest(
    tableName: String,
    key: Map[String, AttributeValue],
    condition: Option[RequestCondition]
)

case class ScanamoUpdateRequest(
    tableName: String,
    key: Map[String, AttributeValue],
    updateExpression: String,
    attributeNames: Map[String, String],
    attributeValues: Map[String, AttributeValue],
    condition: Option[RequestCondition]
)

case class ScanamoScanRequest(
    tableName: String,
    index: Option[String],
    options: ScanamoQueryOptions
)

case class ScanamoQueryRequest(
    tableName: String,
    index: Option[String],
    query: Query[_],
    options: ScanamoQueryOptions
)

case class ScanamoQueryOptions(
    consistent: Boolean,
    limit: Option[Int],
    exclusiveStartKey: Option[EvaluationKey],
    filter: Option[Condition[_]]
)
object ScanamoQueryOptions {
  val default = ScanamoQueryOptions(false, None, None, None)
}

case class RequestCondition(
    expression: String,
    attributeNames: Map[String, String],
    attributeValues: Option[Map[String, AttributeValue]]
)

Revert "Add ScanIndexForward property to query options"
Revert "Add ScanIndexForward property to query options"

This reverts commit 0296997de5d0d30d10b66ae54e7857a01860970f.
