;; Orders layout defcomps — fully self-contained via IO primitives.
;; Registered via register_sx_layout("orders", ...) in __init__.py.

;; --- orders layout: root + auth + orders rows ---

(defcomp ~layouts/full (&key (list-url :as string))
  (<> (~root-header-auto)
    (~shared:layout/header-child-sx
      :inner (<> (~auth-header-row-auto)
               (~shared:auth/orders-header-row :list-url (or list-url "/"))))))

(defcomp ~layouts/oob (&key (list-url :as string))
  (<> (~auth-header-row-auto true)
    (~shared:layout/oob-header-sx
      :parent-id "auth-header-child"
      :row (~shared:auth/orders-header-row :list-url (or list-url "/")))
    (~root-header-auto true)))

(defcomp ~layouts/mobile ()
  (~root-mobile-auto))

;; --- order-detail layout: root + auth + orders + order rows ---

(defcomp ~layouts/order-detail-layout-full (&key (list-url :as string) (detail-url :as string))
  (<> (~root-header-auto)
    (~shared:orders/detail-header-stack
      :auth (~auth-header-row-auto)
      :orders (~shared:auth/orders-header-row :list-url (or list-url "/"))
      :order (~shared:layout/menu-row-sx :id "order-row" :level 3 :colour "sky"
               :link-href (or detail-url "/") :link-label "Order"
               :icon "fa fa-gbp"))))

(defcomp ~layouts/order-detail-layout-oob (&key (detail-url :as string))
  (<> (~shared:layout/oob-header-sx
        :parent-id "orders-header-child"
        :row (~shared:layout/menu-row-sx :id "order-row" :level 3 :colour "sky"
               :link-href (or detail-url "/") :link-label "Order"
               :icon "fa fa-gbp" :oob true))
    (~root-header-auto true)))

(defcomp ~layouts/order-detail-layout-mobile ()
  (~root-mobile-auto))
