package jetbrains.mps.build.scripts;

/*Generated by MPS */

import jetbrains.mps.lang.script.runtime.BaseMigrationScript;
import jetbrains.mps.lang.script.runtime.AbstractMigrationRefactoring;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import org.jetbrains.mps.openapi.model.SNode;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SModelOperations;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.mps.openapi.model.SNodeReference;
import org.jetbrains.mps.openapi.persistence.PersistenceFacade;
import org.jetbrains.mps.openapi.language.SConcept;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import org.jetbrains.mps.openapi.language.SContainmentLink;

public final class buildScriptMigration_MigrationScript extends BaseMigrationScript {
  public buildScriptMigration_MigrationScript() {
    super("buildScript migration");
    this.addRefactoring(new AbstractMigrationRefactoring() {
      @Override
      public String getName() {
        return "update \"copy file\"";
      }
      @Override
      public String getAdditionalInfo() {
        return "update \"copy file\"";
      }
      @Override
      public SAbstractConcept getApplicableConcept() {
        return CONCEPTS.BuildLayout_Copy$E8;
      }
      @Override
      public boolean isApplicableInstanceNode(SNode node) {
        return SNodeOperations.isInstanceOf(SLinkOperations.getTarget(node, LINKS.fileset$tUzn), CONCEPTS.BuildInputSingleFile$4U);
      }
      @Override
      public void doUpdateInstanceNode(SNode node) {
        SNode file = SModelOperations.createNewNode(SNodeOperations.getModel(node), null, CONCEPTS.BuildLayout_File$Kk);
        SNodeOperations.replaceWithAnother(node, file);
        SLinkOperations.setTarget(file, LINKS.path$xmoo, SLinkOperations.getTarget(SNodeOperations.cast(SLinkOperations.getTarget(node, LINKS.fileset$tUzn), CONCEPTS.BuildInputSingleFile$4U), LINKS.path$dYr6));
        ListSequence.fromList(SLinkOperations.getChildren(file, LINKS.smodelAttribute$KJ43)).addSequence(ListSequence.fromList(SLinkOperations.getChildren(node, LINKS.smodelAttribute$KJ43)));
      }
      @Override
      public boolean isShowAsIntention() {
        return true;
      }
    });
    this.addRefactoring(new AbstractMigrationRefactoring() {
      @Override
      public String getName() {
        return "update \"copy files\"";
      }
      @Override
      public String getAdditionalInfo() {
        return "update \"copy files\"";
      }
      @Override
      public SAbstractConcept getApplicableConcept() {
        return CONCEPTS.BuildLayout_Copy$E8;
      }
      @Override
      public boolean isApplicableInstanceNode(SNode node) {
        return SNodeOperations.isInstanceOf(SLinkOperations.getTarget(node, LINKS.fileset$tUzn), CONCEPTS.BuildInputFiles$lR);
      }
      @Override
      public void doUpdateInstanceNode(SNode node) {
        SNode files = SModelOperations.createNewNode(SNodeOperations.getModel(node), null, CONCEPTS.BuildLayout_Files$Oo);
        SNodeOperations.replaceWithAnother(node, files);
        SLinkOperations.setTarget(files, LINKS.path$Wlt3, SLinkOperations.getTarget(SNodeOperations.cast(SLinkOperations.getTarget(node, LINKS.fileset$tUzn), CONCEPTS.BuildInputFiles$lR), LINKS.dir$e6r$));
        ListSequence.fromList(SLinkOperations.getChildren(files, LINKS.parameters$WlG4)).addSequence(ListSequence.fromList(SLinkOperations.getChildren(SNodeOperations.cast(SLinkOperations.getTarget(node, LINKS.fileset$tUzn), CONCEPTS.BuildInputFiles$lR), LINKS.selectors$hp_C)));
        ListSequence.fromList(SLinkOperations.getChildren(files, LINKS.smodelAttribute$KJ43)).addSequence(ListSequence.fromList(SLinkOperations.getChildren(node, LINKS.smodelAttribute$KJ43)));
      }
      @Override
      public boolean isShowAsIntention() {
        return true;
      }
    });
    this.addRefactoring(new AbstractMigrationRefactoring() {
      @Override
      public String getName() {
        return "update \"custom copy file\"";
      }
      @Override
      public String getAdditionalInfo() {
        return "update \"custom copy file\"";
      }
      @Override
      public SAbstractConcept getApplicableConcept() {
        return CONCEPTS.BuildLayout_CustomCopy$bv;
      }
      @Override
      public boolean isApplicableInstanceNode(SNode node) {
        return SNodeOperations.isInstanceOf(SLinkOperations.getTarget(node, LINKS.fileset$tUzn), CONCEPTS.BuildInputSingleFile$4U);
      }
      @Override
      public void doUpdateInstanceNode(SNode node) {
        SNode file = SModelOperations.createNewNode(SNodeOperations.getModel(node), null, CONCEPTS.BuildLayout_File$Kk);
        SNodeOperations.replaceWithAnother(node, file);
        SLinkOperations.setTarget(file, LINKS.path$xmoo, SLinkOperations.getTarget(SNodeOperations.cast(SLinkOperations.getTarget(node, LINKS.fileset$tUzn), CONCEPTS.BuildInputSingleFile$4U), LINKS.path$dYr6));
        ListSequence.fromList(SLinkOperations.getChildren(file, LINKS.parameters$xu7T)).addSequence(ListSequence.fromList(SLinkOperations.getChildren(node, LINKS.handlers$AdkY)));
        ListSequence.fromList(SLinkOperations.getChildren(file, LINKS.smodelAttribute$KJ43)).addSequence(ListSequence.fromList(SLinkOperations.getChildren(node, LINKS.smodelAttribute$KJ43)));
      }
      @Override
      public boolean isShowAsIntention() {
        return true;
      }
    });
    this.addRefactoring(new AbstractMigrationRefactoring() {
      @Override
      public String getName() {
        return "update \"custom copy files\"";
      }
      @Override
      public String getAdditionalInfo() {
        return "update \"custom copy files\"";
      }
      @Override
      public SAbstractConcept getApplicableConcept() {
        return CONCEPTS.BuildLayout_CustomCopy$bv;
      }
      @Override
      public boolean isApplicableInstanceNode(SNode node) {
        return SNodeOperations.isInstanceOf(SLinkOperations.getTarget(node, LINKS.fileset$tUzn), CONCEPTS.BuildInputFiles$lR);
      }
      @Override
      public void doUpdateInstanceNode(SNode node) {
        SNode files = SModelOperations.createNewNode(SNodeOperations.getModel(node), null, CONCEPTS.BuildLayout_Files$Oo);
        SNodeOperations.replaceWithAnother(node, files);
        SLinkOperations.setTarget(files, LINKS.path$Wlt3, SLinkOperations.getTarget(SNodeOperations.cast(SLinkOperations.getTarget(node, LINKS.fileset$tUzn), CONCEPTS.BuildInputFiles$lR), LINKS.dir$e6r$));
        ListSequence.fromList(SLinkOperations.getChildren(files, LINKS.parameters$WlG4)).addSequence(ListSequence.fromList(SLinkOperations.getChildren(SNodeOperations.cast(SLinkOperations.getTarget(node, LINKS.fileset$tUzn), CONCEPTS.BuildInputFiles$lR), LINKS.selectors$hp_C)));
        ListSequence.fromList(SLinkOperations.getChildren(files, LINKS.parameters$WlG4)).addSequence(ListSequence.fromList(SLinkOperations.getChildren(node, LINKS.handlers$AdkY)));
        ListSequence.fromList(SLinkOperations.getChildren(files, LINKS.smodelAttribute$KJ43)).addSequence(ListSequence.fromList(SLinkOperations.getChildren(node, LINKS.smodelAttribute$KJ43)));
      }
      @Override
      public boolean isShowAsIntention() {
        return true;
      }
    });
  }

  @Nullable
  @Override
  public SNodeReference getScriptNode() {
    return PersistenceFacade.getInstance().createNodeReference("r:ecaa17fb-f6f8-4afb-8802-fe6c92efd2d3(jetbrains.mps.build.scripts)/4380385936562228087");
  }

  private static final class CONCEPTS {
    /*package*/ static final SConcept BuildLayout_Copy$E8 = MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x48d5d03db92339b9L, "jetbrains.mps.build.structure.BuildLayout_Copy");
    /*package*/ static final SConcept BuildInputSingleFile$4U = MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x48d5d03db9224596L, "jetbrains.mps.build.structure.BuildInputSingleFile");
    /*package*/ static final SConcept BuildLayout_File$Kk = MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x7ea63ceef6e8c0edL, "jetbrains.mps.build.structure.BuildLayout_File");
    /*package*/ static final SConcept BuildInputFiles$lR = MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x48d5d03db92245a4L, "jetbrains.mps.build.structure.BuildInputFiles");
    /*package*/ static final SConcept BuildLayout_Files$Oo = MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x262a04c08b56faffL, "jetbrains.mps.build.structure.BuildLayout_Files");
    /*package*/ static final SConcept BuildLayout_CustomCopy$bv = MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x7f76698a394d9ab2L, "jetbrains.mps.build.structure.BuildLayout_CustomCopy");
  }

  private static final class LINKS {
    /*package*/ static final SContainmentLink fileset$tUzn = MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x7f76698a394d9b91L, 0x48d5d03db92339baL, "fileset");
    /*package*/ static final SContainmentLink path$xmoo = MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x7ea63ceef6e8c0edL, 0x7ea63ceef6e8c11aL, "path");
    /*package*/ static final SContainmentLink path$dYr6 = MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x48d5d03db9224596L, 0x48d5d03db922459aL, "path");
    /*package*/ static final SContainmentLink smodelAttribute$KJ43 = MetaAdapterFactory.getContainmentLink(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x10802efe25aL, 0x47bf8397520e5942L, "smodelAttribute");
    /*package*/ static final SContainmentLink path$Wlt3 = MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x262a04c08b56faffL, 0x262a04c08b56fb00L, "path");
    /*package*/ static final SContainmentLink dir$e6r$ = MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x48d5d03db92245a4L, 0x48d5d03db92245a6L, "dir");
    /*package*/ static final SContainmentLink parameters$WlG4 = MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x262a04c08b56faffL, 0x262a04c08b56fb01L, "parameters");
    /*package*/ static final SContainmentLink selectors$hp_C = MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x48d5d03db92245a4L, 0x48d5d03db92245f7L, "selectors");
    /*package*/ static final SContainmentLink parameters$xu7T = MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x7ea63ceef6e8c0edL, 0x7ea63ceef6e8c126L, "parameters");
    /*package*/ static final SContainmentLink handlers$AdkY = MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x7f76698a394d9ab2L, 0x7f76698a394e2d1eL, "handlers");
  }
}
