// =============================================================================
// AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
// Generated by: scripts/generate_dom_elements.ts
// =============================================================================

///| Element factories for server-side rendering

///|

///| Provides html, head, body and common HTML elements.

///| No event handlers - use islands for interactivity.

// =============================================================================
// Helper functions
// =============================================================================

///|
/// Create a server-side element
fn create_element(
  tag : String,
  attrs : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  @luna.h(tag, attrs, children)
}

///|
/// Create an SVG element (same as create_element but marked for clarity)
/// Note: SVG namespace is handled during rendering, VNode is namespace-agnostic
fn create_svg_element(
  tag : String,
  attrs : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  @luna.h(tag, attrs, children)
}

///|
/// Create a static attribute
fn static_attr(value : String) -> @luna.Attr[Unit, String] {
  @luna.attr_static(value)
}

///|
/// Build attribute array from common properties
fn build_attrs(
  id : String?,
  class : String?,
  style : String?,
  attrs : Array[(String, @luna.Attr[Unit, String])]?,
) -> Array[(String, @luna.Attr[Unit, String])] {
  let result : Array[(String, @luna.Attr[Unit, String])] = []
  if id is Some(v) {
    result.push(("id", static_attr(v)))
  }
  if class is Some(v) {
    result.push(("class", static_attr(v)))
  }
  if style is Some(v) {
    result.push(("style", static_attr(v)))
  }
  if attrs is Some(extra) {
    for attr in extra {
      result.push(attr)
    }
  }
  result
}

// =============================================================================

// HTML Element factories

// =============================================================================

///|
/// Create an html element
pub fn html(
  lang? : String,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  if lang is Some(v) {
    props.push(("lang", static_attr(v)))
  }
  create_element("html", props, children)
}

///|
/// Create a head element
pub fn head(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("head", props, children)
}

///|
/// Create a body element
pub fn body(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("body", props, children)
}

///|
/// Create a title element
pub fn title(
  content : String,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("title", props, [text(content)])
}

///|
/// Create a meta element
pub fn meta(
  charset? : String,
  name? : String,
  content? : String,
  http_equiv? : String,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  if charset is Some(v) {
    props.push(("charset", static_attr(v)))
  }
  if name is Some(v) {
    props.push(("name", static_attr(v)))
  }
  if content is Some(v) {
    props.push(("content", static_attr(v)))
  }
  if http_equiv is Some(v) {
    props.push(("http-equiv", static_attr(v)))
  }
  create_element("meta", props, [])
}

///|
/// Create a link element
pub fn link(
  rel? : String,
  href? : String,
  type_? : String,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  if rel is Some(v) {
    props.push(("rel", static_attr(v)))
  }
  if href is Some(v) {
    props.push(("href", static_attr(v)))
  }
  if type_ is Some(v) {
    props.push(("type", static_attr(v)))
  }
  create_element("link", props, [])
}

///|
/// Create a script element
pub fn script(
  src? : String,
  type_? : String,
  defer_? : Bool,
  async_? : Bool,
  content? : String,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  if src is Some(v) {
    props.push(("src", static_attr(v)))
  }
  if type_ is Some(v) {
    props.push(("type", static_attr(v)))
  }
  if defer_ is Some(true) {
    props.push(("defer", static_attr("")))
  }
  if async_ is Some(true) {
    props.push(("async", static_attr("")))
  }
  let script_children : Array[@luna.Node[Unit, String]] = if content is Some(c) {
    [text(c)]
  } else {
    []
  }
  create_element("script", props, script_children)
}

///|
/// Create a style element
pub fn style_(
  content : String,
  type_? : String,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  if type_ is Some(v) {
    props.push(("type", static_attr(v)))
  }
  create_element("style", props, [text(content)])
}

///|
/// Create a main element
pub fn main_(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("main", props, children)
}

///|
/// Create a nav element
pub fn nav(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("nav", props, children)
}

///|
/// Create a header element
pub fn header_(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("header", props, children)
}

///|
/// Create a footer element
pub fn footer_(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("footer", props, children)
}

///|
/// Create a section element
pub fn section(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("section", props, children)
}

///|
/// Create an article element
pub fn article(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("article", props, children)
}

///|
/// Create an aside element
pub fn aside(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("aside", props, children)
}

///|
/// Create a div element
pub fn div(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("div", props, children)
}

///|
/// Create a span element
pub fn span(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("span", props, children)
}

///|
/// Create a p element
pub fn p(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("p", props, children)
}

///|
/// Create an anchor element
pub fn a(
  href? : String,
  target? : String,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  if href is Some(v) {
    props.push(("href", static_attr(v)))
  }
  if target is Some(v) {
    props.push(("target", static_attr(v)))
  }
  create_element("a", props, children)
}

///|
/// Create h1 element
pub fn h1(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("h1", props, children)
}

///|
/// Create h2 element
pub fn h2(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("h2", props, children)
}

///|
/// Create h3 element
pub fn h3(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("h3", props, children)
}

///|
/// Create h4 element
pub fn h4(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("h4", props, children)
}

///|
/// Create h5 element
pub fn h5(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("h5", props, children)
}

///|
/// Create h6 element
pub fn h6(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("h6", props, children)
}

///|
/// Create ul element
pub fn ul(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("ul", props, children)
}

///|
/// Create ol element
pub fn ol(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("ol", props, children)
}

///|
/// Create li element
pub fn li(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("li", props, children)
}

///|
/// Create a button element
pub fn button(
  disabled? : Bool,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  if disabled is Some(true) {
    props.push(("disabled", static_attr("")))
  }
  create_element("button", props, children)
}

///|
/// Create an input element
pub fn input(
  type_? : String,
  name? : String,
  value? : String,
  placeholder? : String,
  disabled? : Bool,
  readonly_? : Bool,
  required? : Bool,
  checked? : Bool,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  if type_ is Some(v) {
    props.push(("type", static_attr(v)))
  }
  if name is Some(v) {
    props.push(("name", static_attr(v)))
  }
  if value is Some(v) {
    props.push(("value", static_attr(v)))
  }
  if placeholder is Some(v) {
    props.push(("placeholder", static_attr(v)))
  }
  if disabled is Some(true) {
    props.push(("disabled", static_attr("")))
  }
  if readonly_ is Some(true) {
    props.push(("readonly", static_attr("")))
  }
  if required is Some(true) {
    props.push(("required", static_attr("")))
  }
  if checked is Some(true) {
    props.push(("checked", static_attr("")))
  }
  create_element("input", props, [])
}

///|
/// Create a form element
pub fn form(
  action? : String,
  http_method? : String,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  if action is Some(v) {
    props.push(("action", static_attr(v)))
  }
  if http_method is Some(v) {
    props.push(("method", static_attr(v)))
  }
  create_element("form", props, children)
}

///|
/// Create a label element
pub fn label(
  for_? : String,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  if for_ is Some(v) {
    props.push(("for", static_attr(v)))
  }
  create_element("label", props, children)
}

///|
/// Create img element
pub fn img(
  src? : String,
  alt? : String,
  width? : String,
  height? : String,
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  if src is Some(v) {
    props.push(("src", static_attr(v)))
  }
  if alt is Some(v) {
    props.push(("alt", static_attr(v)))
  }
  if width is Some(v) {
    props.push(("width", static_attr(v)))
  }
  if height is Some(v) {
    props.push(("height", static_attr(v)))
  }
  create_element("img", props, [])
}

///|
/// Create br element
pub fn br(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("br", props, [])
}

///|
/// Create hr element
pub fn hr(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("hr", props, [])
}

///|
/// Create strong element
pub fn strong(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("strong", props, children)
}

///|
/// Create em element
pub fn em(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("em", props, children)
}

///|
/// Create code element
pub fn code(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("code", props, children)
}

///|
/// Create pre element
pub fn pre(
  id? : String,
  class? : String,
  style? : String,
  attrs? : Array[(String, @luna.Attr[Unit, String])],
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  let props = build_attrs(id, class, style, attrs)
  create_element("pre", props, children)
}

// =============================================================================
// Text and Fragment helpers
// =============================================================================

///|
/// Create a text node
pub fn text(content : String) -> @luna.Node[Unit, String] {
  @luna.text(content)
}

///|
/// Create a fragment (multiple nodes without wrapper)
pub fn fragment(
  children : Array[@luna.Node[Unit, String]],
) -> @luna.Node[Unit, String] {
  @luna.fragment(children)
}

///|
/// Create static attribute
pub fn attr(value : String) -> @luna.Attr[Unit, String] {
  @luna.attr_static(value)
}