(ns auto-ap.datomic.migrate.yodlee2)

(def norms-map {::add-yodlee-view
                {:txes [[{:db/ident :yodlee-provider-account/id
                          :db/doc "Yodlee Provider ACcount Id"
                          :db/valueType :db.type/long
                          :db/cardinality :db.cardinality/one
                          :db/unique :db.unique/identity}
                         {:db/ident :yodlee-provider-account/client
                          :db/doc "Which client the provider account is for"
                          :db/valueType :db.type/ref
                          :db/cardinality :db.cardinality/one}
                         {:db/ident :yodlee-provider-account/accounts
                          :db/doc "Individual bank accounts"
                          :db/isComponent true
                          :db/valueType :db.type/ref
                          :db/cardinality :db.cardinality/many}
                         {:db/ident :yodlee-provider-account/status
                          :db/doc "Current status"
                          :db/valueType :db.type/string
                          :db/cardinality :db.cardinality/one}
                         {:db/ident :yodlee-provider-account/detailed-status
                          :db/doc "Current status (detail)"
                          :db/valueType :db.type/string
                          :db/cardinality :db.cardinality/one}
                         {:db/ident :yodlee-provider-account/last-updated
                          :db/doc "Last updated date"
                          :db/valueType :db.type/instant
                          :db/cardinality :db.cardinality/one}

                         {:db/ident :yodlee-account/id
                          :db/doc "Yodlee account id"
                          :db/valueType :db.type/long
                          :db/cardinality :db.cardinality/one
                          :db/unique :db.unique/identity}
                         {:db/ident :yodlee-account/name
                          :db/doc "account name"
                          :db/valueType :db.type/string
                          :db/cardinality :db.cardinality/one}
                         {:db/ident :yodlee-account/number
                          :db/doc "account number"
                          :db/valueType :db.type/string
                          :db/cardinality :db.cardinality/one}
                         {:db/ident :yodlee-account/status
                          :db/doc "Current status"
                          :db/valueType :db.type/string
                          :db/cardinality :db.cardinality/one}
                         {:db/ident :yodlee-account/available-balance
                          :db/doc "Available Balance"
                          :db/valueType :db.type/double
                          :db/cardinality :db.cardinality/one}

                         {:db/ident :bank-account/yodlee-account
                          :db/doc "Yodlee account for the bank account"
                          :db/valueType :db.type/ref
                          :db/cardinality :db.cardinality/one}]]}})
