/**
   * ************************************************************************
   *
   * <p>Decide on the campaign
   *
   * @param playerInfo - the user to evaluate
   * @param executionTime - when
   * @param responseFactor
   * @return - resulting action. (or null)
   */
  public ActionInterface evaluate(
      PlayerInfo playerInfo,
      Timestamp executionTime,
      double responseFactor,
      ResponseStat response) {

    Timestamp executionDay = getDay(executionTime);
    User user = playerInfo.getUser();

    if (user.sessions < ACTIVITY_MIN) {

      System.out.println(
          "    -- Campaign "
              + Name
              + " not active. Player has not been active enough ("
              + user.sessions
              + " sessions <  "
              + ACTIVITY_MIN);
      return null;
    }

    Timestamp lastSession = playerInfo.getLastMobileSession();
    if (lastSession == null) {

      System.out.println("    -- Campaign " + Name + " not firing. No sessions for user");
      return null;
    }
    int inactivity = getDaysBetween(lastSession, executionDay);

    if (user.payments == 0 && inactivity > INACTIVITY_LIMIT_FREE) {

      System.out.println(
          "    -- Campaign "
              + Name
              + " not active. Free player is inactive. ("
              + inactivity
              + " days >  "
              + INACTIVITY_LIMIT_FREE);
      return null;
    }

    if (user.payments > 0 && inactivity > INACTIVITY_LIMIT_PAYING) {

      System.out.println(
          "    -- Campaign "
              + Name
              + " not active. Paying player is inactive. ("
              + inactivity
              + " days >  "
              + INACTIVITY_LIMIT_PAYING);
      return null;
    }

    UsageProfileClassification classification = playerInfo.getUsageProfile();

    if (!classification.hasTriedMobile()) {

      System.out.println(
          "    -- Campaign "
              + Name
              + " not active. Not a mobile player. ( Classification: "
              + classification.name()
              + " )");
      return null;
    }

    boolean fallBackToMail = playerInfo.getCachedUserData().fallbackFromMobile();

    if (inactivity < 4) {

      System.out.println(
          "    -- Campaign "
              + Name
              + " Not firing. Waiting for inactivity...("
              + inactivity
              + "< 4)");
      return null;
    }

    if (inactivity > 4 && inactivity < 10) {

      if (fallBackToMail) {
        System.out.println("    -- Campaign " + Name + " firing (1) but falling back to mail. ");
        return new EmailAction(
            getMail1(user),
            user,
            executionTime,
            getPriority(),
            getTag(),
            201,
            getState(),
            responseFactor);
      }

      System.out.println("    -- Campaign " + Name + " firing (1) with a mobile push. ");
      return new MobilePushAction(
          "Hello, the games are awaiting you. Level up to take part of new benefits!",
          user,
          executionTime,
          getPriority(),
          getTag(),
          Name,
          301,
          getState(),
          responseFactor);
    }

    if (inactivity >= 10 && inactivity < 16) {

      System.out.println("    -- Campaign " + Name + " firing 10 day email ");
      return new EmailAction(
          getMail7(user, createPromoCode(207)),
          user,
          executionTime,
          getPriority(),
          getTag(),
          207,
          getState(),
          responseFactor);
    }

    if (inactivity >= 16 && inactivity < 24) {

      if (fallBackToMail) {
        System.out.println("    -- Campaign " + Name + " firing (2) but falling back to mail. ");
        return new EmailAction(
            getMail2(user),
            user,
            executionTime,
            getPriority(),
            getTag(),
            202,
            getState(),
            responseFactor);
      }

      System.out.println("    -- Campaign " + Name + " firing (2) with a mobile push. ");
      return new MobilePushAction(
          "What a lovely day for some exciting slots!",
          user,
          executionTime,
          getPriority(),
          getTag(),
          Name,
          302,
          getState(),
          responseFactor);
    }

    if (inactivity >= 24 && inactivity < 32) {

      if (fallBackToMail) {
        System.out.println("    -- Campaign " + Name + " firing (3) but falling back to mail. ");
        return new EmailAction(
                getMail3(user),
                user,
                executionTime,
                getPriority(),
                getTag(),
                203,
                getState(),
                responseFactor)
            .attach(
                new GiveCoinAction(
                    2000,
                    user,
                    executionTime,
                    getPriority(),
                    Name,
                    203,
                    getState(),
                    responseFactor));
      }
      System.out.println("    -- Campaign " + Name + " firing (3) with a mobile push. ");
      return new MobilePushAction(
              "We have added 2000 extra coins to your account!",
              user,
              executionTime,
              getPriority(),
              getTag(),
              Name,
              303,
              getState(),
              responseFactor)
          .attach(
              new GiveCoinAction(
                  2000, user, executionTime, getPriority(), Name, 303, getState(), responseFactor));
    }

    if (inactivity >= 32 && inactivity < 40) {

      if (fallBackToMail) {
        System.out.println("    -- Campaign " + Name + " firing (4) but falling back to mail. ");
        return new EmailAction(
            getMail4(user),
            user,
            executionTime,
            getPriority(),
            getTag(),
            204,
            getState(),
            responseFactor);
      }
      System.out.println("    -- Campaign " + Name + " firing (4) with a mobile push. ");
      return new MobilePushAction(
          "There are new games released! Come in and check them out!",
          user,
          executionTime,
          getPriority(),
          getTag(),
          Name,
          304,
          getState(),
          responseFactor);
    }

    if (inactivity >= 40 && inactivity < 48) {

      if (fallBackToMail) {
        System.out.println("    -- Campaign " + Name + " firing (5) but falling back to mail. ");
        return new EmailAction(
            getMail5(user),
            user,
            executionTime,
            getPriority(),
            getTag(),
            205,
            getState(),
            responseFactor);
      }

      System.out.println("    -- Campaign " + Name + " firing (5) with a mobile push. ");
      return new MobilePushAction(
          "There are new games released! Come in and check them out!",
          user,
          executionTime,
          getPriority(),
          getTag(),
          Name,
          305,
          getState(),
          responseFactor);
    }

    if (inactivity >= 48) {

      System.out.println("    -- Campaign " + Name + " firing (6) - email. ");
      return new EmailAction(
          getMail6(user),
          user,
          executionTime,
          getPriority(),
          getTag(),
          206,
          getState(),
          responseFactor);
    }

    System.out.println("    -- Campaign " + Name + " Not firing, inactive too long ");

    return null;
  }