/**
   * Delivers an order to a customer
   *
   * @param _order to be delivered
   */
  public void deliverOrder(Order _order) {
    if (_order.getOrderStatus() != OrderStatus.cooked) {
      System.out.println(
          "Cashier.deliverOrder: Error order "
              + _order.getId()
              + " not completed "
              + _order.getOrderStatus());
      return;
    }

    try {
      Thread.sleep(Constants.DELIVERY_TIME);

      DataPacket packet = new DataPacket(Function.SET_ORDER_DELIVERED);
      packet.order = _order;
      this.communicateWithServer(packet);

      this.client.update("Delivered order");
      System.out.println(
          "Order "
              + _order.getId()
              + " delivered by "
              + this.getFirstName().charAt(0)
              + "."
              + this.getSurname());
    } catch (Exception e) {
      System.out.println("Cashier.deliverOrder: Error exception " + e.getMessage());
    }
  }
  /**
   * Adds the passed order to the system
   *
   * @param order to add
   */
  public void addOrder(Order _order) {
    DataPacket packet = new DataPacket(Function.ADD_ORDER);
    packet.order = _order;
    this.communicateWithServer(packet);

    this.orders.add(_order.getId());

    // System.out.println("Cashier[" + this.getFirstName().charAt(0) + "." + this.getSurname() + "]
    // added new order");
    if (this.client != null) this.client.update("Added order");
  }