// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/AchievementEvents.java
// public enum AchievementEvents {
//   buildUnpinned,
//   buildTagged,
//   testBombed,
//   testDisarmed,
//   compilationBroken,
//   investigationDelegated,
//   investigationTaken,
//   issueMentioned,
//   changeAdded,
//   userAction // with 5 minutes resolution
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEvents.java
// public interface UserEvents {
//   void registerEvent(@NotNull String eventName);
// 
//   void registerEvent(@NotNull String eventName, @Nullable Object additionalData);
// 
//   long getLastEventTime(@NotNull String eventName);
// 
//   // most recent first
//   @NotNull
//   List<Long> getEventTimes(@NotNull String eventName);
// 
//   int getNumberOfEvents(@NotNull String eventName);
// 
//   float getEventsRate(@NotNull String eventName, int timeIntervalSeconds);
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEventsListener.java
// public interface UserEventsListener extends EventListener {
//   void userEventPublished(@NotNull User user, @NotNull String eventName, @Nullable Object additionalData);
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEventsRegistry.java
// public interface UserEventsRegistry {
//   @NotNull
//   UserEvents getUserEvents(@NotNull User user);
// 
//   void addListener(@NotNull UserEventsListener listener);
// 
//   void removeListener(@NotNull UserEventsListener listener);
// }


import jetbrains.buildServer.users.SUser;
import jetbrains.buildServer.users.User;
import jetbrains.buildServer.vcs.SVcsModification;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.buildserver.achievements.AchievementEvents;
import org.jetbrains.buildserver.achievements.UserEvents;
import org.jetbrains.buildserver.achievements.UserEventsListener;
import org.jetbrains.buildserver.achievements.UserEventsRegistry;
import java.util.Calendar;
import java.util.Date;
        SVcsModification mod = (SVcsModification) additionalData;
        Date vcsDate = mod.getVcsDate();
        if (Calendar.getInstance().getTime().getTime() - vcsDate.getTime() < 24 * 3600 * 1000) {
          userEventsRegistry.getUserEvents(user).registerEvent(getId() + ":changeAdded");
        }
      }
    });
  }

  @NotNull
  public String getId() {
    return "productivityBoost";
  }

  @NotNull
  public String getName() {
    return "Productivity Boost";
  }

  @NotNull
  public String getDescription() {
    return "Granted for making a lot of commits during the day.";
  }

  @Nullable
  public String getIconClassNames() {
    return "icon-thumbs-up";
  }

  @Override
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/AchievementEvents.java
// public enum AchievementEvents {
//   buildUnpinned,
//   buildTagged,
//   testBombed,
//   testDisarmed,
//   compilationBroken,
//   investigationDelegated,
//   investigationTaken,
//   issueMentioned,
//   changeAdded,
//   userAction // with 5 minutes resolution
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEvents.java
// public interface UserEvents {
//   void registerEvent(@NotNull String eventName);
// 
//   void registerEvent(@NotNull String eventName, @Nullable Object additionalData);
// 
//   long getLastEventTime(@NotNull String eventName);
// 
//   // most recent first
//   @NotNull
//   List<Long> getEventTimes(@NotNull String eventName);
// 
//   int getNumberOfEvents(@NotNull String eventName);
// 
//   float getEventsRate(@NotNull String eventName, int timeIntervalSeconds);
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEventsListener.java
// public interface UserEventsListener extends EventListener {
//   void userEventPublished(@NotNull User user, @NotNull String eventName, @Nullable Object additionalData);
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEventsRegistry.java
// public interface UserEventsRegistry {
//   @NotNull
//   UserEvents getUserEvents(@NotNull User user);
// 
//   void addListener(@NotNull UserEventsListener listener);
// 
//   void removeListener(@NotNull UserEventsListener listener);
// }


// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/impl/ProductivityBoost.java
import jetbrains.buildServer.users.SUser;
import jetbrains.buildServer.users.User;
import jetbrains.buildServer.vcs.SVcsModification;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.buildserver.achievements.AchievementEvents;
import org.jetbrains.buildserver.achievements.UserEvents;
import org.jetbrains.buildserver.achievements.UserEventsListener;
import org.jetbrains.buildserver.achievements.UserEventsRegistry;
import java.util.Calendar;
import java.util.Date;

        SVcsModification mod = (SVcsModification) additionalData;
        Date vcsDate = mod.getVcsDate();
        if (Calendar.getInstance().getTime().getTime() - vcsDate.getTime() < 24 * 3600 * 1000) {
          userEventsRegistry.getUserEvents(user).registerEvent(getId() + ":changeAdded");
        }
      }
    });
  }

  @NotNull
  public String getId() {
    return "productivityBoost";
  }

  @NotNull
  public String getName() {
    return "Productivity Boost";
  }

  @NotNull
  public String getDescription() {
    return "Granted for making a lot of commits during the day.";
  }

  @Nullable
  public String getIconClassNames() {
    return "icon-thumbs-up";
  }

  @Override
  public boolean shouldGrantAchievement(@NotNull SUser user, @NotNull UserEvents events, @NotNull String lastEventName, @Nullable Object additionalData) {