package com.airlock.iam.plugin.configeditor.data.tree;

import com.airlock.iam.plugin.api.config.ConfigurationContext;
import com.airlock.iam.plugin.configeditor.data.TreeLabel;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public class LabelTreeItem implements TreeItem<TreeLabel> {
   private final TreeLabel treeLabel;
   private final ConfigurationContext configurationContext;

   public LabelTreeItem(String text, TreeItem<?> parentIdentifier, ConfigurationContext context) {
      this.treeLabel = new TreeLabel(text, parentIdentifier);
      this.configurationContext = context;
   }

   @Override
   public String toString() {
      return this.treeLabel.toString();
   }

   @Override
   public boolean equals(Object obj) {
      return !(obj instanceof LabelTreeItem) ? false : this.treeLabel.equals(((LabelTreeItem)obj).treeLabel);
   }

   @Override
   public int hashCode() {
      return this.treeLabel.hashCode();
   }

   public TreeLabel getTreeItemIdentifier() {
      return this.treeLabel;
   }

   @SuppressFBWarnings(justification = "generated code")
   public TreeLabel getTreeLabel() {
      return this.treeLabel;
   }

   @SuppressFBWarnings(justification = "generated code")
   public ConfigurationContext getConfigurationContext() {
      return this.configurationContext;
   }
}
