;; orphan-care -- orphan sponsorship ledger
(define-data-var child-count uint u0)
(define-data-var total-sponsored uint u0)
(define-map children uint { name: (string-ascii 30), age: uint, sponsor: principal, monthly: uint, active: bool })
(define-public (add-child (name (string-ascii 30)) (age uint) (monthly uint))
(let ((id (+ (var-get child-count) u1)))
(var-set child-count id)
(map-set children id { name: name, age: age, sponsor: tx-sender, monthly: monthly, active: true })
(var-set total-sponsored (+ (var-get total-sponsored) u1)) (ok id)))
(define-public (end-sponsorship (id uint))
(let ((c (unwrap! (map-get? children id) (err u404))))
(map-set children id (merge c { active: false })) (ok true)))
(define-read-only (get-child (id uint)) (map-get? children id))
(define-read-only (get-total) (var-get total-sponsored))