// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/impl/Achievement.java
// public interface Achievement {
//   @NotNull
//   String getId();
// 
//   @NotNull
//   String getName();
// 
//   @NotNull
//   String getDescription();
// 
//   @Nullable
//   String getIconClassNames();
// 
//   boolean shouldGrantAchievement(@NotNull SUser user, @NotNull UserEvents events, @NotNull String lastEventName, @Nullable Object lastEventAdditionalData);
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/impl/AchievementProperties.java
// public class AchievementProperties {
//   @NotNull
//   public static PluginPropertyKey getHidePropertyKey(@NotNull Achievement achievement) {
//     return new PluginPropertyKey("achievements", "achievements", "achievement.hidden." + achievement.getId());
//   }
// 
//   @NotNull
//   public static PluginPropertyKey getGrantedPropertyKey(@NotNull Achievement achievement) {
//     return new PluginPropertyKey("achievements", "achievements", "achievement.granted." + achievement.getId());
//   }
// 
//   @NotNull
//   public static PluginPropertyKey getAchievementsEnabledPropertyKey() {
//     return new PluginPropertyKey("achievements", "achievements", "enabled");
//   }
// }


import jetbrains.buildServer.users.PluginPropertyKey;
import jetbrains.buildServer.users.User;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.buildserver.achievements.impl.Achievement;
import org.jetbrains.buildserver.achievements.impl.AchievementProperties;
/*
 * Copyright 2000-2021 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jetbrains.buildserver.achievements.controller;


public class AchievementBean {
  private final Achievement myAchievement;

  public AchievementBean(@NotNull Achievement achievement) {
    myAchievement = achievement;
  }

  @NotNull
  public String getHidePropertyKey() {
    return makePropertyKey().getKey();
  }

  public Achievement getAchievement() {
    return myAchievement;
  }

  public boolean isHidden(@NotNull User user) {
    return user.getBooleanProperty(makePropertyKey());
  }

  @NotNull
  private PluginPropertyKey makePropertyKey() {
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/impl/Achievement.java
// public interface Achievement {
//   @NotNull
//   String getId();
// 
//   @NotNull
//   String getName();
// 
//   @NotNull
//   String getDescription();
// 
//   @Nullable
//   String getIconClassNames();
// 
//   boolean shouldGrantAchievement(@NotNull SUser user, @NotNull UserEvents events, @NotNull String lastEventName, @Nullable Object lastEventAdditionalData);
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/impl/AchievementProperties.java
// public class AchievementProperties {
//   @NotNull
//   public static PluginPropertyKey getHidePropertyKey(@NotNull Achievement achievement) {
//     return new PluginPropertyKey("achievements", "achievements", "achievement.hidden." + achievement.getId());
//   }
// 
//   @NotNull
//   public static PluginPropertyKey getGrantedPropertyKey(@NotNull Achievement achievement) {
//     return new PluginPropertyKey("achievements", "achievements", "achievement.granted." + achievement.getId());
//   }
// 
//   @NotNull
//   public static PluginPropertyKey getAchievementsEnabledPropertyKey() {
//     return new PluginPropertyKey("achievements", "achievements", "enabled");
//   }
// }


// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/controller/AchievementBean.java
import jetbrains.buildServer.users.PluginPropertyKey;
import jetbrains.buildServer.users.User;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.buildserver.achievements.impl.Achievement;
import org.jetbrains.buildserver.achievements.impl.AchievementProperties;

/*
 * Copyright 2000-2021 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jetbrains.buildserver.achievements.controller;


public class AchievementBean {
  private final Achievement myAchievement;

  public AchievementBean(@NotNull Achievement achievement) {
    myAchievement = achievement;
  }

  @NotNull
  public String getHidePropertyKey() {
    return makePropertyKey().getKey();
  }

  public Achievement getAchievement() {
    return myAchievement;
  }

  public boolean isHidden(@NotNull User user) {
    return user.getBooleanProperty(makePropertyKey());
  }

  @NotNull
  private PluginPropertyKey makePropertyKey() {
    return AchievementProperties.getHidePropertyKey(myAchievement);