<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
  <bpmn2:process id="Process_1" isExecutable="false">
    <bpmn2:startEvent id="StartEvent_1">
      <bpmn2:outgoing>Flow_15szjml</bpmn2:outgoing>
    </bpmn2:startEvent>
    <bpmn2:sequenceFlow id="Flow_15szjml" sourceRef="StartEvent_1" targetRef="initialisation" />
    <bpmn2:scriptTask id="initialisation" name="init" scriptFormat="JavaScript">
      <bpmn2:incoming>Flow_15szjml</bpmn2:incoming>
      <bpmn2:outgoing>Flow_13oog85</bpmn2:outgoing>
      <bpmn2:script>let newTicket = {
    id: 0,
    title: "test_workflows",
    description: [
        "Nom : " + data.formcreator_field_781,
        "Prénom : " + data.formcreator_field_782,
        "Code FDT : " + data.formcreator_field_778,
    ].join("\n"),
    users_id_requester: data.formcreator_field_805,
    users_id_assign: 2765,
};

this.data.tickets = newTicket;

let ticketValidation = {
    input: {
        users_id_validate: 2765,
        comment_submission: "Validation requise par l'entité d'affectation",
    }
};

this.data.ticketValidation = ticketValidation;

// Ne pas initialiser de compteur de cycles</bpmn2:script>
    </bpmn2:scriptTask>
    <bpmn2:serviceTask id="create_ticket" name="création ticket" camunda:delegateExpression="createTicket">
      <bpmn2:extensionElements>
        <camunda:inputOutput>
          <camunda:inputParameter name="tickets">
            <camunda:script scriptFormat="JavaScript">this.data.tickets</camunda:script>
          </camunda:inputParameter>
          <camunda:inputParameter name="ticketValidation">
            <camunda:script scriptFormat="JavaScript">this.data.ticketValidation</camunda:script>
          </camunda:inputParameter>
        </camunda:inputOutput>
      </bpmn2:extensionElements>
      <bpmn2:incoming>Flow_13oog85</bpmn2:incoming>
      <bpmn2:outgoing>Flow_1jbdkkd</bpmn2:outgoing>
    </bpmn2:serviceTask>
    <bpmn2:sequenceFlow id="Flow_13oog85" sourceRef="initialisation" targetRef="create_ticket" />
    <bpmn2:sequenceFlow id="Flow_1jbdkkd" sourceRef="create_ticket" targetRef="activity_entity_validation" />
    <bpmn2:serviceTask id="activity_entity_validation" name="Validation" camunda:delegateExpression="pollTicketValidation">
      <bpmn2:incoming>Flow_1jbdkkd</bpmn2:incoming>
      <bpmn2:outgoing>Flow_0pq82im</bpmn2:outgoing>
    </bpmn2:serviceTask>
    <bpmn2:exclusiveGateway id="Gateway_closed_ticket" name="ticket clos ?">
      <bpmn2:incoming>Flow_0pq82im</bpmn2:incoming>
      <bpmn2:outgoing>Flow_1jg0g88</bpmn2:outgoing>
      <bpmn2:outgoing>Flow_1ynrgpa</bpmn2:outgoing>
    </bpmn2:exclusiveGateway>
    <bpmn2:sequenceFlow id="Flow_0pq82im" sourceRef="activity_entity_validation" targetRef="Gateway_closed_ticket" />
    <bpmn2:serviceTask id="Activity_killsession" name="Killsession" camunda:delegateExpression="killSession">
      <bpmn2:incoming>Flow_1jg0g88</bpmn2:incoming>
      <bpmn2:incoming>Flow_1ynrgpa</bpmn2:incoming>
      <bpmn2:outgoing>Flow_0q51v8z</bpmn2:outgoing>
    </bpmn2:serviceTask>
    <bpmn2:sequenceFlow id="Flow_1jg0g88" name="Oui" sourceRef="Gateway_closed_ticket" targetRef="Activity_killsession" />
    <bpmn2:endEvent id="Event_0x1mja7" name="Fin">
      <bpmn2:incoming>Flow_0q51v8z</bpmn2:incoming>
    </bpmn2:endEvent>
    <bpmn2:sequenceFlow id="Flow_0q51v8z" sourceRef="Activity_killsession" targetRef="Event_0x1mja7" />
    <bpmn2:sequenceFlow id="Flow_1ynrgpa" name="Non" sourceRef="Gateway_closed_ticket" targetRef="Activity_killsession" />
  </bpmn2:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNEdge id="Flow_1ynrgpa_di" bpmnElement="Flow_1ynrgpa">
        <di:waypoint x="950" y="283" />
        <di:waypoint x="950" y="298" />
        <di:waypoint x="1270" y="298" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="919" y="291" width="21" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0q51v8z_di" bpmnElement="Flow_0q51v8z">
        <di:waypoint x="1370" y="298" />
        <di:waypoint x="1422" y="298" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1jg0g88_di" bpmnElement="Flow_1jg0g88">
        <di:waypoint x="950" y="233" />
        <di:waypoint x="950" y="130" />
        <di:waypoint x="1320" y="130" />
        <di:waypoint x="1320" y="258" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="961" y="223" width="18" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0pq82im_di" bpmnElement="Flow_0pq82im">
        <di:waypoint x="880" y="258" />
        <di:waypoint x="925" y="258" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1jbdkkd_di" bpmnElement="Flow_1jbdkkd">
        <di:waypoint x="740" y="258" />
        <di:waypoint x="780" y="258" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_13oog85_di" bpmnElement="Flow_13oog85">
        <di:waypoint x="600" y="258" />
        <di:waypoint x="640" y="258" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_15szjml_di" bpmnElement="Flow_15szjml">
        <di:waypoint x="448" y="258" />
        <di:waypoint x="500" y="258" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="412" y="240" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1hlt7bs_di" bpmnElement="initialisation">
        <dc:Bounds x="500" y="218" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_1bf6sfb_di" bpmnElement="create_ticket">
        <dc:Bounds x="640" y="218" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0t2wcd7_di" bpmnElement="activity_entity_validation">
        <dc:Bounds x="780" y="218" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_025sckl_di" bpmnElement="Gateway_closed_ticket" isMarkerVisible="true">
        <dc:Bounds x="925" y="233" width="50" height="50" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="981" y="251" width="57" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_05mv5la_di" bpmnElement="Activity_killsession">
        <dc:Bounds x="1270" y="258" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_0x1mja7_di" bpmnElement="Event_0x1mja7">
        <dc:Bounds x="1422" y="280" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="1432" y="323" width="16" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn2:definitions>
