package jetbrains.mps.samples.ChemMastery.constraints;

/*Generated by MPS */

import jetbrains.mps.smodel.runtime.base.BaseConstraintsDescriptor;
import jetbrains.mps.smodel.runtime.base.BasePropertyConstraintsDescriptor;
import jetbrains.mps.smodel.runtime.ConstraintsDescriptor;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import java.util.Map;
import org.jetbrains.mps.openapi.language.SProperty;
import jetbrains.mps.smodel.runtime.PropertyConstraintsDescriptor;
import java.util.HashMap;
import org.jetbrains.mps.openapi.language.SConcept;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;

public class Element_Constraints extends BaseConstraintsDescriptor {
  public Element_Constraints() {
    super(CONCEPTS.Element$LI);
  }

  public static class Details_url_Property extends BasePropertyConstraintsDescriptor {
    public Details_url_Property(ConstraintsDescriptor container) {
      super(PROPS.details_url$Z4AP, container, true, false, false);
    }
    @Override
    public Object getValue(SNode node) {
      String id = SPropertyOperations.getString(node, PROPS.id$GqdZ);
      if (id != null) {
        return "https://www.periodni.com/" + id.toLowerCase() + ".html";
      } else {
        return "";
      }
    }
  }
  @Override
  protected Map<SProperty, PropertyConstraintsDescriptor> getSpecifiedProperties() {
    Map<SProperty, PropertyConstraintsDescriptor> properties = new HashMap<SProperty, PropertyConstraintsDescriptor>();
    properties.put(PROPS.details_url$Z4AP, new Details_url_Property(this));
    return properties;
  }

  private static final class CONCEPTS {
    /*package*/ static final SConcept Element$LI = MetaAdapterFactory.getConcept(0xa9a262e8f8054598L, 0x88c614f38937d309L, 0x6ef7184faba53971L, "jetbrains.mps.samples.ChemMastery.structure.Element");
  }

  private static final class PROPS {
    /*package*/ static final SProperty details_url$Z4AP = MetaAdapterFactory.getProperty(0xa9a262e8f8054598L, 0x88c614f38937d309L, 0x6ef7184faba53971L, 0x2b5828a8c1e2ab18L, "details_url");
    /*package*/ static final SProperty id$GqdZ = MetaAdapterFactory.getProperty(0xa9a262e8f8054598L, 0x88c614f38937d309L, 0x6ef7184faba53971L, 0x5b2638e8bdcd7deaL, "id");
  }
}
