(ns auto-ap.entities.invoice
  (:require [clojure.spec.alpha :as s]
            [auto-ap.entities.shared :as shared]))

(s/def ::vendor map?)
(s/def ::vendor-name string?)
(s/def ::client map?)
(s/def ::invoice-number ::shared/required-identifier)
(s/def ::date ::shared/date)
(s/def ::due (s/nilable ::shared/date))
(s/def ::scheduled-payment (s/nilable ::shared/date))
(s/def ::total ::shared/money)
(s/def ::vendor-id ::shared/identifier)

(s/def ::invoice (s/keys :req-un [::client
                                  ::invoice-number
                                  ::date
                                  ::vendor
                                  ::total]
                         :opt-un [::vendor-name
                                  ::due
                                  ::scheduled-payment
                                  ]))
