;; next/genesis/object-types/define-codec.sx
;;
;; Meta-object that registers a content codec — an encode/decode
;; pair. The bootstrap bundle ships dag-cbor, raw, and dag-json
;; codecs; new codecs can be added via Create{DefineCodec{...}}.

(DefineObject
  :name "DefineCodec"
  :doc "Codec registration. :name identifies the codec ('dag-cbor',\n        'raw', 'dag-json', ...); :encode and :decode are the\n        SX bodies the kernel calls when serialising / parsing\n        artifacts under this codec."
  :schema (fn
    (obj)
    (and
      (string? (-> obj :name))
      (not (nil? (-> obj :encode)))
      (not (nil? (-> obj :decode))))))
