             [taoensso.timbre        :as timbre]
             [taoensso.nippy         :as nippy]
             [taoensso.faraday.utils :as utils])
-  (:import  [com.amazonaws.services.dynamodb.model
+  (:import  [com.amazonaws.services.dynamodbv2.model
              AttributeValue
+             AttributeDefinition
              BatchGetItemRequest
              BatchGetItemResult
-             BatchResponse
+             ;; BatchResponse
              BatchWriteItemRequest
              BatchWriteItemResult
-             BatchWriteResponse
+             ;; BatchWriteResponse
              Condition
              CreateTableRequest
              UpdateTableRequest

                          (str/lower-case)
                          (keyword))}))

  BatchWriteResponse
  (as-map [result]
    {:consumed-capacity-units (.getConsumedCapacityUnits result)})

  BatchWriteItemResult
  (as-map [result]
    {:responses         (utils/fmap as-map (into {} (.getResponses result)))
     :unprocessed-items (.getUnprocessedItems result)})

  BatchResponse
  (as-map [result]
    {:consumed-capacity-units (.getConsumedCapacityUnits result)
     :items (some->> (.getItems result)
                     (into [])
                     (utils/fmap #(utils/fmap db-val->clj-val (into {} %))))})

  KeysAndAttributes
  (as-map [result]

     :unprocessed-keys (utils/fmap as-map (into {} (.getUnprocessedKeys result)))})

  GetItemResult (as-map [result] (db-map->clj-map (.getItem result)))

  nil (as-map [_] nil))

