<?xml version="1.0" encoding="UTF-8"?>
<actions>

<meta>
  <description>Template für internes Testen</description>
</meta>


<action id="connect">
  <s>_renewed := false()</s>
</action>

<action id="update-all">
  <s>vl:delete-current-books()</s>
  <s>book := {"title": "ABC", "author": "an author", "dueDate": current-date() + xs:dayTimeDuration("P2D"), "statusId": "critical"}</s>
  <s>book := {"title": "DEF", "author": "another author", "dueDate": current-date() + xs:dayTimeDuration("P10D"), "statusId": "critical", "test": "foobar2"}</s>
  <s>book := {"title": "GHI", "author": "another author", "dueDate": current-date() + xs:dayTimeDuration(if ($_renewed) then "P50D" else "P1D"), "statusId": "normal", "test": "foobar3"}</s>
  <s>book := {"title": "JKL", "author": "another author", "dueDate": current-date() + xs:dayTimeDuration(if ($_renewed) then "P50D" else "P1D"), "statusId": "normal", "test": "foobar4"}</s>
</action>


<action id="renew-list">
  <s>_renewed := true()</s>
  <call action="update-all"/>
</action>

<action id="cancel-list">
</action>




<action id="search">  
  <s>book := {"title": "foo", "author": "a"},
     book := {"title": "foo 2", "author": "a"},
     book := {"title": "fu fighters", "author": "b", "holdings": (
       {"title": "ex 1", "libraryBranch": "neverlands", "orderable": false()},
       {"title": "queen's", "libraryBranch": "fillory"}
     )}
  </s>
</action>


<action id="search-next-page">
</action>

<action id="search-details">
</action>

<action id="order-single">
  <s> vl:confirm("internal-order", "Book: " || serialize-json($book) || $line-ending|| $line-ending || "Holding: "||serialize-json($holding)) </s>
</action>

<action id="internal-order">
  <s>if ($confirm-result) then ($book.statusId:="ordered") else ()</s>
</action>

</actions>
