   "Schema for a Terminal"
   {:context js/CanvasRenderingContext2D
    :options TerminalOptions
-   :rows (s/pred integer?)
-   :cols (s/pred integer?)
-   :size (s/constrained s/Num >zero?)
+   :rows (schema/pred integer?)
+   :cols (schema/pred integer?)
+   :size (schema/constrained schema/Num >zero?)
    :content TerminalContent})

(ns fluch.schemas
  (:require [schema.core :as s :include-macros true]))

(enable-console-print!)

(defn in-unit-interval? [x]
  (and (>= x 0.0) (<= 1.0)))
(def UnitInterval (s/constrained s/Num in-unit-interval?))

(defn in-byte-range? [x]
  (and (<= x 255) (>= x 0) (integer? x)))


(def TerminalFont
  "Schema for a terminal font"
  {:family schema/Str
   :ratio [(schema/one schema/Num "x-ratio")
           (schema/one schema/Num "y-ratio")]})

(def TerminalOffset
  [(schema/one schema/Num "col-offset")
   (schema/one schema/Num "row-offset")])

(def TerminalOptions
  "Schema for Terminal Options"
