;; SatGuard Config Registry
(define-constant err-owner (err u1120))
(define-constant err-nf (err u1121))
(define-data-var admin principal tx-sender)
(define-map config-str {key: (string-ascii 30)} {val: (string-ascii 100),sa: uint})
(define-map config-uint {key: (string-ascii 30)} {val: uint,sa: uint})
(define-read-only (get-config (key (string-ascii 30))) (map-get? config-str {key: key}))
(define-read-only (get-config-uint (key (string-ascii 30))) (map-get? config-uint {key: key}))
(define-public (set-config (key (string-ascii 30)) (val (string-ascii 100)))
(begin
(asserts! (is-eq tx-sender (var-get admin)) err-owner)
(map-set config-str {key: key} {val: val,sa: block-height})
(print {e: "config-set",key: key,val: val})
(ok true)))
(define-public (set-config-uint (key (string-ascii 30)) (val uint))
(begin
(asserts! (is-eq tx-sender (var-get admin)) err-owner)
(map-set config-uint {key: key} {val: val,sa: block-height})
(print {e: "config-uint-set",key: key,val: val})
(ok true)))
(define-public (delete-config (key (string-ascii 30)))
(begin
(asserts! (is-eq tx-sender (var-get admin)) err-owner)
(map-delete config-str {key: key})
(map-delete config-uint {key: key})
(print {e: "config-deleted",key: key})
(ok true)))