#set page(width: auto, height: auto)
#import "/src/lib.typ": *

#diagram({
  _par("a", display-name: "Alice")
  _par("b", display-name: "Bob")

  _evt("a", "enable")
  _gap()
  _seq("a", "b")
  _evt("a", "disable")
  _gap()
  _evt("a", "enable")
  _evt("b", "enable")
  _seq("a", "b")
  _evt("a", "enable")
  _evt("b", "enable")
  _gap()
  _seq("a", "b")
  _evt("a", "disable")
  _evt("b", "disable")
  _gap()
  _evt("a", "disable")
  _evt("b", "disable")
})

#pagebreak()

#diagram({
  _par("a", display-name: "Alice")
  _par("b", display-name: "Bob")
  _par("c", display-name: "Charlie")
  
  _seq("a", "b")
  _gap()
  _seq("a", "b", enable-dst: true)
  _evt("c", "create")
  _seq("c", "a")
  _evt("b", "destroy")
})

#pagebreak()

#diagram({
  _par("a", display-name: "Alice")
  _par("b", display-name: "Bob")

  _seq("a", "b")
  _evt("b", "enable")
  _seq("a", "b")
  _evt("b", "enable", lifeline-style: (fill: red))
  _gap()
  _seq("b", "a")
  _evt("b", "disable")
  _seq("a", "b")
  _evt("b", "enable", lifeline-style: (
    stroke: (
      paint: green,
      dash: "dashed",
      thickness: 2pt
    )
  ))
  _gap()
  _seq("b", "a")
  _evt("b", "disable")
  _seq("b", "a")
  _evt("b", "disable")
  _seq("a", "b")
  _evt("b", "enable", lifeline-style: (
    radius: 4pt
  ))
  _gap()
  _seq("b", "a")
  _evt("b", "disable")
})
