;; Copyright (C) 2013 Anders Sundman <anders@4zm.org>
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

(ns spira.core.system
  (:require [spira.dm.garden :as garden]
            [spira.dm.plant-desc :as plant-desc]
            [spira.dm.in-memory-repo :as mem-repo]))

;; A representation of the applications total top level state.
(defrecord SystemState [garden-repo plant-desc-repo])

(defn dev-system []
  "Create a light weight development state"
  (->SystemState
   (mem-repo/memory-garden-repo)
   (mem-repo/memory-plant-description-repo)))


;; Copyright (C) 2013 Anders Sundman <anders@4zm.org>
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

(ns spira.core.system
  (:require [spira.dm.garden :as garden]
            [spira.dm.plant-desc :as plant-desc]
            [spira.dm.in-memory-repo :as mem-repo]
            [spira.datomic-adapter.repo :as da]))

;; A representation of the applications total top level state.
(defrecord SystemState [garden-repo plant-desc-repo])

(defn mem-dev-system []
  "Create a light weight development state"
  (->SystemState
   (mem-repo/memory-garden-repo)
   (mem-repo/memory-plant-description-repo)))

(defn dev-system []
  "Create a light weight development state"
  (let [uri da/test-uri]
    (da/create-test-db uri)
    (->SystemState
     (da/datomic-garden-repo uri)
     (da/datomic-plant-description-repo uri))))

Use in memory datomic db by default
Use in memory datomic db by default

4ZM/spira