#lang racket/base

; An helper to fill a webcontainer with weblets
(require
  "../collection/tree.rkt")

(provide
  website
  website-node-url
  website-node-type
  website-node-weblet)

; Values in the website tree
(struct website-node
  (url ; the partial url of the link, relative to parent
   type ; the type of weblet
   weblet ; the weblet associated (or a link for symlinks and redirections)
   ))

; website syntax to build the structure
(define-syntax website
  (syntax-rules ()
    ( (website path type weblet (childparam ...) ...)
      (tree
        (if (equal? path "") #f path)
        (website-node
          path
          (quote type)
          weblet)
        (list
          (website childparam ...)
          ...)))))
