package jetbrains.mps.lang.aspect.typesystem;

/*Generated by MPS */

import jetbrains.mps.lang.typesystem.runtime.AbstractNonTypesystemRule_Runtime;
import jetbrains.mps.lang.typesystem.runtime.NonTypesystemRule_Runtime;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.typesystem.inference.TypeCheckingContext;
import jetbrains.mps.lang.typesystem.runtime.IsApplicableStatus;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.errors.messageTargets.MessageTarget;
import jetbrains.mps.errors.messageTargets.NodeMessageTarget;
import jetbrains.mps.errors.IErrorReporter;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import org.jetbrains.mps.openapi.language.SContainmentLink;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.language.SReferenceLink;
import org.jetbrains.mps.openapi.language.SProperty;
import org.jetbrains.mps.openapi.language.SConcept;

public class check_SpecificAspectRootConfig_NonTypesystemRule extends AbstractNonTypesystemRule_Runtime implements NonTypesystemRule_Runtime {
  public check_SpecificAspectRootConfig_NonTypesystemRule() {
  }
  public void applyRule(final SNode arc, final TypeCheckingContext typeCheckingContext, IsApplicableStatus status) {
    ListSequence.fromList(SLinkOperations.getChildren(arc, LINKS.primary$7jJ7)).union(ListSequence.fromList(SLinkOperations.getChildren(arc, LINKS.secondary$7kd9))).union(ListSequence.fromList(SLinkOperations.getChildren(arc, LINKS.auxiliary$7pPx))).visitAll((it) -> {
      if (!(SPropertyOperations.getBoolean(SLinkOperations.getTarget(it, LINKS.cpnt$Miim), PROPS.rootable$_9pz))) {
        {
          final MessageTarget errorTarget = new NodeMessageTarget();
          IErrorReporter _reporter_2309309498 = typeCheckingContext.reportWarning(it, "Concept is not denoted as 'rootable'", "r:6fc198d3-4608-4f97-ad36-1c3a4d4eae24(jetbrains.mps.lang.aspect.typesystem)", "1728071633590041832", null, errorTarget);
        }
      }
    });
  }
  public SAbstractConcept getApplicableConcept() {
    return CONCEPTS.SpecificAspectRootConfig$HU;
  }
  public IsApplicableStatus isApplicableAndPattern(SNode argument) {
    return new IsApplicableStatus(argument.getConcept().isSubConceptOf(getApplicableConcept()), null);
  }
  public boolean overrides() {
    return false;
  }

  private static final class LINKS {
    /*package*/ static final SContainmentLink primary$7jJ7 = MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x6ed0e6c2f31b3e45L, 0x6ed0e6c2f31b559aL, "primary");
    /*package*/ static final SContainmentLink secondary$7kd9 = MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x6ed0e6c2f31b3e45L, 0x6ed0e6c2f31b559cL, "secondary");
    /*package*/ static final SContainmentLink auxiliary$7pPx = MetaAdapterFactory.getContainmentLink(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x6ed0e6c2f31b3e45L, 0x6ed0e6c2f31b559fL, "auxiliary");
    /*package*/ static final SReferenceLink cpnt$Miim = MetaAdapterFactory.getReferenceLink(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0x6ed0e6c2f31b3f42L, 0x6ed0e6c2f31b3f67L, "cpnt");
  }

  private static final class PROPS {
    /*package*/ static final SProperty rootable$_9pz = MetaAdapterFactory.getProperty(0xc72da2b97cce4447L, 0x8389f407dc1158b7L, 0xf979ba0450L, 0xff49c1d648L, "rootable");
  }

  private static final class CONCEPTS {
    /*package*/ static final SConcept SpecificAspectRootConfig$HU = MetaAdapterFactory.getConcept(0xf159adf43c9340f9L, 0x9c5a1f245a8697afL, 0x6ed0e6c2f31b3e45L, "jetbrains.mps.lang.aspect.structure.SpecificAspectRootConfig");
  }
}
