<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" id="definitions" name="Udostępnienie zbiorów specjalnych" targetNamespace="http://bpmn.io/schema/bpmn" exporter="tok" exporterVersion="0.1" modeler:executionPlatform="Camunda Cloud" modeler:executionPlatformVersion="8.10.0">
  <bpmn:collaboration id="collaboration">
    <bpmn:participant id="biblioteka" name="Biblioteka uczelniana" processRef="udostepnienie-zbiorow" />
  </bpmn:collaboration>
  <bpmn:process id="udostepnienie-zbiorow" name="Udostępnienie zbiorów specjalnych" isExecutable="true">
    <bpmn:laneSet id="biblioteka-lanes">
      <bpmn:lane id="czytelnik" name="Czytelnik">
        <bpmn:flowNodeRef>wniosek</bpmn:flowNodeRef>
      </bpmn:lane>
      <bpmn:lane id="system" name="System biblioteczny">
        <bpmn:flowNodeRef>tryb</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>jaki</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>odmowa-auto</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>scalenie</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>termin</bpmn:flowNodeRef>
      </bpmn:lane>
      <bpmn:lane id="kierownik" name="Kierownik Oddziału Zbiorów Specjalnych">
        <bpmn:flowNodeRef>decyzja</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>brak</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>zgoda</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>odmowa</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>wygasl</bpmn:flowNodeRef>
      </bpmn:lane>
      <bpmn:lane id="czytelnia" name="Czytelnia zbiorów specjalnych">
        <bpmn:flowNodeRef>przygotowanie</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>udostepnione</bpmn:flowNodeRef>
      </bpmn:lane>
    </bpmn:laneSet>
    <bpmn:startEvent id="wniosek" name="Wniosek złożony">
      <bpmn:extensionElements>
        <zeebe:formDefinition formId="f-wniosek" />
      </bpmn:extensionElements>
    </bpmn:startEvent>
    <bpmn:businessRuleTask id="tryb" name="Ustalenie trybu udostępnienia">
      <bpmn:extensionElements>
        <zeebe:calledDecision decisionId="tryb-udostepnienia" resultVariable="tryb" />
      </bpmn:extensionElements>
    </bpmn:businessRuleTask>
    <bpmn:exclusiveGateway id="jaki" name="Jaki tryb udostępnienia?" default="f-jaki-odmowa-auto" />
    <bpmn:endEvent id="odmowa-auto" name="Odmowa udostępnienia" />
    <bpmn:exclusiveGateway id="scalenie" />
    <bpmn:scriptTask id="termin" name="Wyznaczenie terminu w czytelni">
      <bpmn:extensionElements>
        <zeebe:script expression="=if pilne = true then 2 else 7" resultVariable="dni" />
      </bpmn:extensionElements>
    </bpmn:scriptTask>
    <bpmn:userTask id="decyzja" name="Decyzja kierownika">
      <bpmn:extensionElements>
        <zeebe:userTask />
        <zeebe:formDefinition formId="f-decyzja" />
      </bpmn:extensionElements>
    </bpmn:userTask>
    <bpmn:boundaryEvent id="brak" name="Minęło 5 dni" attachedToRef="decyzja">
      <bpmn:timerEventDefinition id="brak-def">
        <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">P5D</bpmn:timeDuration>
      </bpmn:timerEventDefinition>
    </bpmn:boundaryEvent>
    <bpmn:exclusiveGateway id="zgoda" name="Czy kierownik się zgodził?" default="f-zgoda-odmowa" />
    <bpmn:endEvent id="odmowa" name="Wniosek odrzucony" />
    <bpmn:endEvent id="wygasl" name="Wniosek wygasł" />
    <bpmn:userTask id="przygotowanie" name="Przygotowanie materiałów">
      <bpmn:extensionElements>
        <zeebe:userTask />
        <zeebe:formDefinition formId="f-przygotowanie" />
      </bpmn:extensionElements>
    </bpmn:userTask>
    <bpmn:endEvent id="udostepnione" name="Materiały udostępnione" />
    <bpmn:sequenceFlow id="f-wniosek-tryb" sourceRef="wniosek" targetRef="tryb" />
    <bpmn:sequenceFlow id="f-tryb-jaki" sourceRef="tryb" targetRef="jaki" />
    <bpmn:sequenceFlow id="f-jaki-scalenie" name="czytelnia" sourceRef="jaki" targetRef="scalenie">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=tryb = "czytelnia"</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="f-jaki-decyzja" name="zgoda kierownika" sourceRef="jaki" targetRef="decyzja">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=tryb = "zgoda kierownika"</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="f-jaki-odmowa-auto" name="odmowa" sourceRef="jaki" targetRef="odmowa-auto" />
    <bpmn:sequenceFlow id="f-decyzja-zgoda" sourceRef="decyzja" targetRef="zgoda" />
    <bpmn:sequenceFlow id="f-zgoda-scalenie" name="tak" sourceRef="zgoda" targetRef="scalenie">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=zgoda = true</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="f-zgoda-odmowa" name="nie" sourceRef="zgoda" targetRef="odmowa" />
    <bpmn:sequenceFlow id="f-brak-wygasl" sourceRef="brak" targetRef="wygasl" />
    <bpmn:sequenceFlow id="f-scalenie-termin" sourceRef="scalenie" targetRef="termin" />
    <bpmn:sequenceFlow id="f-termin-przygotowanie" sourceRef="termin" targetRef="przygotowanie" />
    <bpmn:sequenceFlow id="f-przygotowanie-udostepnione" sourceRef="przygotowanie" targetRef="udostepnione" />
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="collaboration">
      <bpmndi:BPMNShape id="biblioteka_di" bpmnElement="biblioteka" isHorizontal="true">
        <dc:Bounds x="0" y="0" width="1150" height="640" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="czytelnik_di" bpmnElement="czytelnik" isHorizontal="true">
        <dc:Bounds x="30" y="0" width="1120" height="130" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="system_di" bpmnElement="system" isHorizontal="true">
        <dc:Bounds x="30" y="130" width="1120" height="140" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="kierownik_di" bpmnElement="kierownik" isHorizontal="true">
        <dc:Bounds x="30" y="270" width="1120" height="230" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="czytelnia_di" bpmnElement="czytelnia" isHorizontal="true">
        <dc:Bounds x="30" y="500" width="1120" height="140" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="wniosek_di" bpmnElement="wniosek">
        <dc:Bounds x="90" y="30" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="66" y="71" width="84" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="tryb_di" bpmnElement="tryb">
        <dc:Bounds x="176" y="160" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="jaki_di" bpmnElement="jaki" isMarkerVisible="true">
        <dc:Bounds x="326" y="175" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="356" y="228" width="80" height="23" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="odmowa-auto_di" bpmnElement="odmowa-auto">
        <dc:Bounds x="458" y="182" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="439" y="223" width="74" height="23" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="scalenie_di" bpmnElement="scalenie" isMarkerVisible="true">
        <dc:Bounds x="676" y="175" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="termin_di" bpmnElement="termin">
        <dc:Bounds x="776" y="160" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="decyzja_di" bpmnElement="decyzja">
        <dc:Bounds x="426" y="300" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="zgoda_di" bpmnElement="zgoda" isMarkerVisible="true">
        <dc:Bounds x="576" y="315" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="553" y="370" width="96" height="23" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="odmowa_di" bpmnElement="odmowa">
        <dc:Bounds x="683" y="322" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="653" y="363" width="96" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="wygasl_di" bpmnElement="wygasl">
        <dc:Bounds x="583" y="430" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="561" y="471" width="80" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="przygotowanie_di" bpmnElement="przygotowanie">
        <dc:Bounds x="926" y="530" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="udostepnione_di" bpmnElement="udostepnione">
        <dc:Bounds x="1076" y="552" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1060" y="593" width="68" height="23" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="brak_di" bpmnElement="brak">
        <dc:Bounds x="478" y="362" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="423" y="401" width="68" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="f-wniosek-tryb_di" bpmnElement="f-wniosek-tryb">
        <di:waypoint x="126" y="48" />
        <di:waypoint x="226" y="48" />
        <di:waypoint x="226" y="160" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-tryb-jaki_di" bpmnElement="f-tryb-jaki">
        <di:waypoint x="276" y="200" />
        <di:waypoint x="326" y="200" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-jaki-scalenie_di" bpmnElement="f-jaki-scalenie">
        <di:waypoint x="351" y="175" />
        <di:waypoint x="351" y="163" />
        <di:waypoint x="701" y="163" />
        <di:waypoint x="701" y="175" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="358" y="148" width="52" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-jaki-decyzja_di" bpmnElement="f-jaki-decyzja">
        <di:waypoint x="351" y="225" />
        <di:waypoint x="351" y="340" />
        <di:waypoint x="426" y="340" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="256" y="277" width="90" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-jaki-odmowa-auto_di" bpmnElement="f-jaki-odmowa-auto">
        <di:waypoint x="376" y="200" />
        <di:waypoint x="458" y="200" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="384" y="185" width="34" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-decyzja-zgoda_di" bpmnElement="f-decyzja-zgoda">
        <di:waypoint x="526" y="340" />
        <di:waypoint x="576" y="340" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-zgoda-scalenie_di" bpmnElement="f-zgoda-scalenie">
        <di:waypoint x="601" y="315" />
        <di:waypoint x="601" y="200" />
        <di:waypoint x="676" y="200" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="608" y="185" width="18" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-zgoda-odmowa_di" bpmnElement="f-zgoda-odmowa">
        <di:waypoint x="626" y="340" />
        <di:waypoint x="683" y="340" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="633" y="325" width="18" height="11" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-brak-wygasl_di" bpmnElement="f-brak-wygasl">
        <di:waypoint x="496" y="398" />
        <di:waypoint x="496" y="448" />
        <di:waypoint x="583" y="448" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-scalenie-termin_di" bpmnElement="f-scalenie-termin">
        <di:waypoint x="726" y="200" />
        <di:waypoint x="776" y="200" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-termin-przygotowanie_di" bpmnElement="f-termin-przygotowanie">
        <di:waypoint x="876" y="200" />
        <di:waypoint x="976" y="200" />
        <di:waypoint x="976" y="530" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="f-przygotowanie-udostepnione_di" bpmnElement="f-przygotowanie-udostepnione">
        <di:waypoint x="1026" y="570" />
        <di:waypoint x="1076" y="570" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
