/// <summary>
        /// Constructor.
        /// Note: Initially two link role definitions, Origin and Target, are declared by default,
        /// plus implementing a default 'link' variant.
        /// Also, their links will be linkable to any other Idea regardless of its kind.
        /// </summary>
        /// <param name="OwnerComposite">Composite Idea definition owning this new one.</param>
        /// <param name="AncestorRelationshipDef">Relationship Idea definition from which this one inherits from.</param>
        /// <param name="Name">Name of the RelationshipDefinition.</param>
        /// <param name="TechName">Technical Name of the RelationshipDefinition.</param>
        /// <param name="RepresentativeShape">Shape visually representing the RelationshipDefinition.</param>
        /// <param name="Summary">Summary of the RelationshipDefinition.</param>
        /// <param name="Pictogram">Image representing the RelationshipDefinition.</param>
        /// <param name="OriginOrParticipantLinkRoleDef">Origin Link-Role Definition or the Participant when the Target Link-Role Definition is null.</param>
        /// <param name="TargetLinkRoleDef">Target Link-Role Definition. If null, then the Relationship is non-directional (only with a Participant Link-Role Definition).</param>
        public RelationshipDefinition(IdeaDefinition OwnerComposite, RelationshipDefinition AncestorRelationshipDef,
                                      string Name, string TechName, string RepresentativeShape, string Summary = "", ImageSource Pictogram = null,
                                      LinkRoleDefinition OriginOrParticipantLinkRoleDef = null, LinkRoleDefinition TargetLinkRoleDef       = null)
            : base(OwnerComposite, Name, TechName, RepresentativeShape, Summary, Pictogram)
        {
            this.AncestorRelationshipDef = AncestorRelationshipDef;

            if (OriginOrParticipantLinkRoleDef == null)
            {
                OriginOrParticipantLinkRoleDef = new LinkRoleDefinition(ERoleType.Origin, "Origin", "Origin", "Origin or participant of the relationship.");
            }

            if (TargetLinkRoleDef == null)
            {
                TargetLinkRoleDef = new LinkRoleDefinition(ERoleType.Target, "Target", "Target", "Target of the relationship.");
            }

            this.OriginOrParticipantLinkRoleDef = OriginOrParticipantLinkRoleDef;
            this.TargetLinkRoleDef = TargetLinkRoleDef;

            this.OriginOrParticipantLinkRoleDef.OwnerRelationshipDef = this;
            this.TargetLinkRoleDef.OwnerRelationshipDef = this;

            // This at last, because requieres link-roles defined
            this.DefaultSymbolFormat = new VisualSymbolFormat(Brushes.LightGray, Brushes.Gray);
            this.DefaultSymbolFormat.InitialWidth  = ApplicationProduct.ProductDirector.DefaultRelationshipCentralSymbolSize.Width;
            this.DefaultSymbolFormat.InitialHeight = ApplicationProduct.ProductDirector.DefaultRelationshipCentralSymbolSize.Height;
            this.DefaultSymbolFormat.SetTextFormat(ETextPurpose.Title, new TextFormat("Arial", 10, Brushes.Black, false, true, false, TextAlignment.Center));

            this.DefaultConnectorsFormat = new VisualConnectorsFormat(this.OwnerDomain.LinkRoleVariants.First(), Plugs.None,
                                                                      this.OwnerDomain.LinkRoleVariants.First(), Plugs.SimpleArrow, Brushes.Black);
        }
#pragma warning restore IDE0060 // Remove unused parameter

        /// <summary>
        /// Validates that the Origin and Target Ideas are linkable.
        /// </summary>
        /// <param name="OriginIdea">Origin of the intended link</param>
        /// <param name="TargetIdea">Target of the intended link</param>
        /// <returns></returns>
        protected bool ValidateAssociabililty(IdeaDefinition OriginIdea, IdeaDefinition TargetIdea)
        {
            bool OriginIsAssociable = (this.OriginOrParticipantLinkRoleDef.AssociableIdeaDefs.Count < 1 ||
                                       this.OriginOrParticipantLinkRoleDef.AssociableIdeaDefs.Any(assocideadef => OriginIdea.IsConsidered(assocideadef)));

            bool TargetIsAssociable = (this.TargetLinkRoleDef.AssociableIdeaDefs.Count < 1 ||
                                       this.TargetLinkRoleDef.AssociableIdeaDefs.Any(assocideadef => TargetIdea.IsConsidered(assocideadef)));

            return(OriginIsAssociable && TargetIsAssociable);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="OwnerComposite">Composite Idea definition owning this new one.</param>
        /// <param name="AncestorConceptDef">Concept Idea definition from which this one inherits from.</param>
        /// <param name="Name">Name of the ConceptDefinition.</param>
        /// <param name="TechName">Technical Name of the ConceptDefinition.</param>
        /// <param name="RepresentativeShape">Shape visually representing the ConceptDefinition.</param>
        /// <param name="Summary">Summary of the ConceptDefinition.</param>
        /// <param name="Pictogram">Image representing the ConceptDefinition.</param>
        public ConceptDefinition(IdeaDefinition OwnerComposite, ConceptDefinition AncestorConceptDef,
                                 string Name, string TechName, string RepresentativeShape, string Summary = "", ImageSource Pictogram = null)
            : base(OwnerComposite, Name, TechName, RepresentativeShape, Summary, Pictogram)
        {
            this.AncestorConceptDef = AncestorConceptDef;

            this.DefaultSymbolFormat = new VisualSymbolFormat(Brushes.WhiteSmoke, Brushes.DimGray);
            this.DefaultSymbolFormat.InitialWidth  = ApplicationProduct.ProductDirector.DefaultConceptBodySymbolSize.Width;
            this.DefaultSymbolFormat.InitialHeight = ApplicationProduct.ProductDirector.DefaultConceptBodySymbolSize.Height;

            this.AutomaticCreationConceptDef_      = this;
            this.AutomaticCreationRelationshipDef_ = this.OwnerDomain.RelationshipDefinitions.FirstOrDefault();
        }
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Indicates whether this Relationship Definition can link supplied origin and target Ideas,
        /// considering its linking roles associability, variants and multiconnectability.
        /// </summary>
        public OperationResult <bool> CanLink(IdeaDefinition OriginIdea, IdeaDefinition TargetIdea,
                                              SimplePresentationElement OriginVariant = null, SimplePresentationElement TargetVariant = null)
        {
            General.ContractRequiresNotNull(OriginIdea, TargetIdea);

            if (!ValidateAssociabililty(OriginIdea, TargetIdea))
            {
                return(OperationResult.Failure <bool>("Origin and Target Ideas are not linkable."));
            }

            if (!ValidateVariants(OriginIdea, OriginVariant, TargetIdea, TargetVariant))
            {
                return(OperationResult.Failure <bool>("Variants are invalid for the intended linking."));
            }

            if (!ValidateMultiConnectability(OriginIdea, TargetIdea))
            {
                return(OperationResult.Failure <bool>("Already exists one non-multiconnectable role used."));
            }

            return(OperationResult.Success(true));
        }
 protected bool ValidateMultiConnectability(IdeaDefinition OriginIdea, IdeaDefinition TargetIdea)
 {
     // PENDING
     return(true);
 }
 protected bool ValidateVariants(IdeaDefinition OriginIdea, SimplePresentationElement OriginVariant,
                                 IdeaDefinition TargetIdea, SimplePresentationElement TargetVariant)
 {
     // PENDING
     return(true);
 }