I have a custom Element (a Form Element) that adds a custom content table for each Element that gets created (similar to how the Matrix Field creates a custom content table for each field). Users can submit data to another custom Element (Form Entry Element) that stores data in that content table.
In my case, when a Form Element is soft-deleted it would need to preserve the custom field layout, tabs, fields, and related content table for the Form Element, along with all the related Form Entry Elements that get added to the content table. And then, if the item was not restored, when Craft purges old Elements from the Trash, all of those items would also need to be deleted.
What are the general considerations I need to know about to handle soft deletes correctly? Are there any specific files or methods in the Craft codebase I can take a closer look at to better understand how this behavior works at the point of the initial soft delete and during the cleanup when things get hard deleted?