(ns auto-ap.graphql.yodlee2
  (:require
   [auto-ap.datomic.yodlee2 :as d-yodlee2]
   [auto-ap.graphql.utils :refer [->graphql <-graphql]]))

(defn get-yodlee-provider-account-page [context args _]
  (let [args (assoc args :id (:id context))
        [yodlee-provider-accounts cnt] (d-yodlee2/get-graphql (<-graphql (assoc args :id (:id context))))]
    {:yodlee_provider_accounts (map ->graphql yodlee-provider-accounts)
     :total cnt
     :count (count yodlee-provider-accounts)
     :start (:start args 0)
     :end (+ (:start args 0) (count yodlee-provider-accounts))}))

