<?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"
                  id="Definitions_NV"
                  targetNamespace="http://forven.com.br/bpmn">

  <bpmn:collaboration id="Collaboration_NV">
    <bpmn:participant id="Participant_NV" name="Ecossistema Nova Venda" processRef="Process_NV" />
  </bpmn:collaboration>

  <bpmn:process id="Process_NV" isExecutable="false">

    <bpmn:laneSet id="LaneSet_NV">
      <bpmn:lane id="Lane_CRM" name="CRM (Leads)">
        <bpmn:flowNodeRef>StartEvent_1</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>Task_LeadCadastrado</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>Task_ConverteCliente</bpmn:flowNodeRef>
      </bpmn:lane>
      <bpmn:lane id="Lane_Representante" name="Representante (Aplicativo de Venda)">
        <bpmn:flowNodeRef>Task_Login</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>Task_MontaCarrinho</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>Task_ConfiguraEntrega</bpmn:flowNodeRef>
      </bpmn:lane>
      <bpmn:lane id="Lane_Aprovacao" name="Regras Comerciais e Aprovação">
        <bpmn:flowNodeRef>Task_EnviaPedido</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>Gateway_PrecisaAprovacao</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>Task_FilaAprovacao</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>Gateway_Decisao</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>Task_VendaReprovada</bpmn:flowNodeRef>
      </bpmn:lane>
      <bpmn:lane id="Lane_ERP" name="ERP Forven">
        <bpmn:flowNodeRef>Task_PedidoERP</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>Task_Fatura</bpmn:flowNodeRef>
        <bpmn:flowNodeRef>EndEvent_1</bpmn:flowNodeRef>
      </bpmn:lane>
    </bpmn:laneSet>

    <bpmn:startEvent id="StartEvent_1" name="Início">
      <bpmn:outgoing>Flow_S1</bpmn:outgoing>
    </bpmn:startEvent>

    <bpmn:task id="Task_LeadCadastrado" name="Lead cadastrado no CRM (opcional)&#10;capturado pelo site ou cadastro manual">
      <bpmn:incoming>Flow_S1</bpmn:incoming>
      <bpmn:outgoing>Flow_1</bpmn:outgoing>
    </bpmn:task>

    <bpmn:task id="Task_ConverteCliente" name="Representante converte o lead em cliente&#10;pelo app ou pelo Console">
      <bpmn:incoming>Flow_1</bpmn:incoming>
      <bpmn:outgoing>Flow_2</bpmn:outgoing>
    </bpmn:task>

    <bpmn:task id="Task_Login" name="Login e seleciona empresa/filial">
      <bpmn:incoming>Flow_2</bpmn:incoming>
      <bpmn:outgoing>Flow_3</bpmn:outgoing>
    </bpmn:task>

    <bpmn:task id="Task_MontaCarrinho" name="Monta o carrinho ou simula a venda&#10;busca produto, define tabela e preço">
      <bpmn:incoming>Flow_3</bpmn:incoming>
      <bpmn:incoming>Flow_Loop</bpmn:incoming>
      <bpmn:outgoing>Flow_4</bpmn:outgoing>
    </bpmn:task>

    <bpmn:task id="Task_ConfiguraEntrega" name="Configura frete, entrega e forma de pagamento">
      <bpmn:incoming>Flow_4</bpmn:incoming>
      <bpmn:outgoing>Flow_5</bpmn:outgoing>
    </bpmn:task>

    <bpmn:task id="Task_EnviaPedido" name="Envia o pedido&#10;entra na fila local (funciona offline)">
      <bpmn:incoming>Flow_5</bpmn:incoming>
      <bpmn:outgoing>Flow_6</bpmn:outgoing>
    </bpmn:task>

    <bpmn:exclusiveGateway id="Gateway_PrecisaAprovacao" name="Dispara regra comercial?&#10;desconto, bonificação, MC, preço">
      <bpmn:incoming>Flow_6</bpmn:incoming>
      <bpmn:outgoing>Flow_7_sim</bpmn:outgoing>
      <bpmn:outgoing>Flow_7_nao</bpmn:outgoing>
    </bpmn:exclusiveGateway>

    <bpmn:task id="Task_FilaAprovacao" name="Pedido aguarda aprovação&#10;Console: Aprovação de Pedidos">
      <bpmn:incoming>Flow_7_sim</bpmn:incoming>
      <bpmn:outgoing>Flow_8</bpmn:outgoing>
    </bpmn:task>

    <bpmn:exclusiveGateway id="Gateway_Decisao" name="Supervisor decide">
      <bpmn:incoming>Flow_8</bpmn:incoming>
      <bpmn:outgoing>Flow_9_aprovado</bpmn:outgoing>
      <bpmn:outgoing>Flow_9_rejeitado</bpmn:outgoing>
    </bpmn:exclusiveGateway>

    <bpmn:task id="Task_VendaReprovada" name="Vira Venda Reprovada&#10;representante corrige e reenvia">
      <bpmn:incoming>Flow_9_rejeitado</bpmn:incoming>
      <bpmn:outgoing>Flow_Loop</bpmn:outgoing>
    </bpmn:task>

    <bpmn:task id="Task_PedidoERP" name="Pedido gravado no ERP&#10;via integração automática">
      <bpmn:incoming>Flow_7_nao</bpmn:incoming>
      <bpmn:incoming>Flow_9_aprovado</bpmn:incoming>
      <bpmn:outgoing>Flow_10</bpmn:outgoing>
    </bpmn:task>

    <bpmn:task id="Task_Fatura" name="Segue para Faturamento e Financeiro&#10;mesmo pipeline de qualquer venda">
      <bpmn:incoming>Flow_10</bpmn:incoming>
      <bpmn:outgoing>Flow_11</bpmn:outgoing>
    </bpmn:task>

    <bpmn:endEvent id="EndEvent_1" name="Fim">
      <bpmn:incoming>Flow_11</bpmn:incoming>
    </bpmn:endEvent>

    <bpmn:sequenceFlow id="Flow_S1" sourceRef="StartEvent_1" targetRef="Task_LeadCadastrado" />
    <bpmn:sequenceFlow id="Flow_1" sourceRef="Task_LeadCadastrado" targetRef="Task_ConverteCliente" />
    <bpmn:sequenceFlow id="Flow_2" sourceRef="Task_ConverteCliente" targetRef="Task_Login" />
    <bpmn:sequenceFlow id="Flow_3" sourceRef="Task_Login" targetRef="Task_MontaCarrinho" />
    <bpmn:sequenceFlow id="Flow_4" sourceRef="Task_MontaCarrinho" targetRef="Task_ConfiguraEntrega" />
    <bpmn:sequenceFlow id="Flow_5" sourceRef="Task_ConfiguraEntrega" targetRef="Task_EnviaPedido" />
    <bpmn:sequenceFlow id="Flow_6" sourceRef="Task_EnviaPedido" targetRef="Gateway_PrecisaAprovacao" />
    <bpmn:sequenceFlow id="Flow_7_sim" name="sim" sourceRef="Gateway_PrecisaAprovacao" targetRef="Task_FilaAprovacao" />
    <bpmn:sequenceFlow id="Flow_7_nao" name="não" sourceRef="Gateway_PrecisaAprovacao" targetRef="Task_PedidoERP" />
    <bpmn:sequenceFlow id="Flow_8" sourceRef="Task_FilaAprovacao" targetRef="Gateway_Decisao" />
    <bpmn:sequenceFlow id="Flow_9_aprovado" name="aprovado" sourceRef="Gateway_Decisao" targetRef="Task_PedidoERP" />
    <bpmn:sequenceFlow id="Flow_9_rejeitado" name="rejeitado" sourceRef="Gateway_Decisao" targetRef="Task_VendaReprovada" />
    <bpmn:sequenceFlow id="Flow_Loop" name="reenvia" sourceRef="Task_VendaReprovada" targetRef="Task_MontaCarrinho" />
    <bpmn:sequenceFlow id="Flow_10" sourceRef="Task_PedidoERP" targetRef="Task_Fatura" />
    <bpmn:sequenceFlow id="Flow_11" sourceRef="Task_Fatura" targetRef="EndEvent_1" />

  </bpmn:process>

  <bpmndi:BPMNDiagram id="BPMNDiagram_NV">
    <bpmndi:BPMNPlane id="BPMNPlane_NV" bpmnElement="Collaboration_NV">

      <bpmndi:BPMNShape id="Participant_NV_di" bpmnElement="Participant_NV" isHorizontal="true">
        <dc:Bounds x="0" y="0" width="1050" height="1880" />
      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="Lane_CRM_di" bpmnElement="Lane_CRM" isHorizontal="true">
        <dc:Bounds x="40" y="0" width="1010" height="380" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Lane_Representante_di" bpmnElement="Lane_Representante" isHorizontal="true">
        <dc:Bounds x="40" y="380" width="1010" height="520" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Lane_Aprovacao_di" bpmnElement="Lane_Aprovacao" isHorizontal="true">
        <dc:Bounds x="40" y="900" width="1010" height="600" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Lane_ERP_di" bpmnElement="Lane_ERP" isHorizontal="true">
        <dc:Bounds x="40" y="1500" width="1010" height="360" />
      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="StartEvent_1_di" bpmnElement="StartEvent_1">
        <dc:Bounds x="362" y="20" width="36" height="36" />
      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="Task_LeadCadastrado_di" bpmnElement="Task_LeadCadastrado">
        <dc:Bounds x="240" y="90" width="280" height="90" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Task_ConverteCliente_di" bpmnElement="Task_ConverteCliente">
        <dc:Bounds x="240" y="250" width="280" height="90" />
      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="Task_Login_di" bpmnElement="Task_Login">
        <dc:Bounds x="240" y="410" width="280" height="90" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Task_MontaCarrinho_di" bpmnElement="Task_MontaCarrinho">
        <dc:Bounds x="240" y="560" width="280" height="90" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Task_ConfiguraEntrega_di" bpmnElement="Task_ConfiguraEntrega">
        <dc:Bounds x="240" y="710" width="280" height="90" />
      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="Task_EnviaPedido_di" bpmnElement="Task_EnviaPedido">
        <dc:Bounds x="240" y="930" width="280" height="90" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_PrecisaAprovacao_di" bpmnElement="Gateway_PrecisaAprovacao" isMarkerVisible="true">
        <dc:Bounds x="355" y="1060" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Task_FilaAprovacao_di" bpmnElement="Task_FilaAprovacao">
        <dc:Bounds x="240" y="1150" width="280" height="90" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_Decisao_di" bpmnElement="Gateway_Decisao" isMarkerVisible="true">
        <dc:Bounds x="355" y="1280" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Task_VendaReprovada_di" bpmnElement="Task_VendaReprovada">
        <dc:Bounds x="600" y="1350" width="260" height="90" />
      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="Task_PedidoERP_di" bpmnElement="Task_PedidoERP">
        <dc:Bounds x="240" y="1530" width="280" height="90" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Task_Fatura_di" bpmnElement="Task_Fatura">
        <dc:Bounds x="240" y="1660" width="280" height="90" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="EndEvent_1_di" bpmnElement="EndEvent_1">
        <dc:Bounds x="362" y="1800" width="36" height="36" />
      </bpmndi:BPMNShape>

      <bpmndi:BPMNEdge id="Flow_S1_di" bpmnElement="Flow_S1">
        <di:waypoint x="380" y="56" />
        <di:waypoint x="380" y="90" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1_di" bpmnElement="Flow_1">
        <di:waypoint x="380" y="180" />
        <di:waypoint x="380" y="250" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_2_di" bpmnElement="Flow_2">
        <di:waypoint x="380" y="340" />
        <di:waypoint x="380" y="410" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_3_di" bpmnElement="Flow_3">
        <di:waypoint x="380" y="500" />
        <di:waypoint x="380" y="560" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_4_di" bpmnElement="Flow_4">
        <di:waypoint x="380" y="650" />
        <di:waypoint x="380" y="710" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_5_di" bpmnElement="Flow_5">
        <di:waypoint x="380" y="800" />
        <di:waypoint x="380" y="930" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_6_di" bpmnElement="Flow_6">
        <di:waypoint x="380" y="1020" />
        <di:waypoint x="380" y="1060" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_7_sim_di" bpmnElement="Flow_7_sim">
        <di:waypoint x="380" y="1110" />
        <di:waypoint x="380" y="1150" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_7_nao_di" bpmnElement="Flow_7_nao">
        <di:waypoint x="405" y="1085" />
        <di:waypoint x="760" y="1085" />
        <di:waypoint x="760" y="1575" />
        <di:waypoint x="520" y="1575" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_8_di" bpmnElement="Flow_8">
        <di:waypoint x="380" y="1240" />
        <di:waypoint x="380" y="1280" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_9_aprovado_di" bpmnElement="Flow_9_aprovado">
        <di:waypoint x="380" y="1330" />
        <di:waypoint x="380" y="1530" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_9_rejeitado_di" bpmnElement="Flow_9_rejeitado">
        <di:waypoint x="405" y="1305" />
        <di:waypoint x="600" y="1305" />
        <di:waypoint x="600" y="1395" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_Loop_di" bpmnElement="Flow_Loop">
        <di:waypoint x="860" y="1395" />
        <di:waypoint x="950" y="1395" />
        <di:waypoint x="950" y="605" />
        <di:waypoint x="520" y="605" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_10_di" bpmnElement="Flow_10">
        <di:waypoint x="380" y="1620" />
        <di:waypoint x="380" y="1660" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_11_di" bpmnElement="Flow_11">
        <di:waypoint x="380" y="1750" />
        <di:waypoint x="380" y="1800" />
      </bpmndi:BPMNEdge>

    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>

</bpmn:definitions>
