import "../library/common.eol";
import "../library/helper.eol";
import "../library/debug.eol";

context ExtendedTestConfiguration {
  //[There are no constraints specified.]
}

context TestConfigurationInstance {
  //[There are no constraints specified.]
}

context TestConfigurationOperation {
  //[There are no constraints specified.]
}

context ComponentReference {
  //[There are no constraints specified.]
}

context ExtendedGateReference {
  //[There are no constraints specified.]
}

context ComponentMerge {
  constraint NoSelfMerge {
    check:   not (self.component.component = self.target.component and
        self.component.configuration = self.target.configuration)
    message:   self.prefix() + 
               "No self-merging, A 'ComponentInstance' shall not be merged with itself, i.e. the source and target 'ComponentInstance's specified by means of the 'ComponentReference's shall be different."
  }

  constraint ComponentMergeType {
    check: self.target.component.type.conformsTo(self.component.component.type)
    message:   self.prefix() + 
               "Conforming 'ComponentType's, The 'ComponentInstance' specified by means of the target 'ComponentReference's shall have a 'ComponentType' which conforms to the 'ComponentType' of the source 'ComponentReference'.."
  }

  //TODO: this is not processed correctly -> update spec or extractor?
  //    -> manually fixed above for now

  //[No self-merging, A 'ComponentInstance' shall not be merged with itself, i.e. the source and target 'ComponentInstance's specified by means of the 'ComponentReference's shall be different. , inv: NoSelfMerge:]
  //[not (self.component.component = self.target.component and]
  //[self.component.configuration = self.target.configuration)]
  //[Conforming 'ComponentType's, The 'ComponentInstance' specified by means of the target 'ComponentReference's shall have a 'ComponentType' which conforms to the 'ComponentType' of the source 'ComponentReference'. , inv: ComponentMergeType:]
  //[self.target.component.type.conformsTo(self.component.component.type)]
}

context ComponentAlias {
  constraint AliasMandatoryName {
    check: not self.name.oclIsUndefined() and self.name.size() > 0
    message:   self.prefix() + 
               "Mandatory name, The 'name' property of the 'ComponentAlias' shall be set and it shall not be an empty String."
  }

  //TODO: this is not processed correctly -> update spec or extractor?
  //    -> manually fixed above for now

  //[Mandatory name, The 'name' property of the 'ComponentAlias' shall be set and it shall not be an empty String., inv: AliasMandatoryName:]
  //[not self.name.oclIsUndefined() and self.name.size() > 0]
}

context ComponentHide {
  //[There are no constraints specified.]
}

context ReassignRole {
  //[There are no constraints specified.]
}
