#import "/src/cetz.typ": draw

#import "/src/core/utils.typ": normalize-measure

#let name = "participant"

#let render(x, y, p, bottom) = {
  let style = p.resolved-style
  let name = box(
    p.display-name,
    inset: style.inset,
    radius: style.radius,
    fill: style.fill,
    stroke: style.stroke
  )
  let anchor = if bottom {"north"} else {"base"}
  draw.content(
    (x, y),
    name,
    anchor: anchor
  )
}

#let get-size(par) = {
  return normalize-measure(box(
    par.display-name,
    inset: par.resolved-style.inset
  ))
}

#let default-style = (
  inset: (
    x: 3pt,
    y: 5pt
  ),
  radius: 2pt
)