I'm modelling the data model for an app and have a case where I want an entity to be able to contain entities of the same entity. This screenshot should clarify the case:
Item is an entity that can either be a stack or a card (determined by the 'type' attribute in it. If it's a stack it will have a relation to a StackProperties entity. However, Stacks can contain both cards and stacks (so stacks can be wrapped into stacks).
The 'items' relation in the StackProperties entity refers to any Items that could be in the stack, and these items could be either cards or stacks.
Question: Is this a proper way of modelling this scenario or is there a better way to achieve this structure? I'm asking because Xcode warns me that StackProperties.items has no inverse relationship, which isn't a good practice. How would this issue best be solved? Since Item already has a (two-way) relation to StackProperties (stackProperties <-> owner) I doubt it's a good solution to add another one for the 'items' relation, to make it inverse.