Building a list of mixed object types, some with multiple levels of hierarchy for targeting

the user has an operation where they must target a list of objects for that operation to affect.

there are four major use cases:

  • User knows exactly what they want; this is usually one to a handful objects, typically of the same type and hierarchy

EX: I want to select Honeycrisp and Golden Delicious specifically

  • User wants to browse for choices inside a container

EX: they look inside the container Fruit / then Fruit / Apples / to locate Fruit / Apples / Honeycrisp and Fruit / Apples / Golden Delicious

  • User is looking for a specific kind of object and needs to browse through a list matching the query

EX: Red Fruits or Red Fruits NOT Apples

  • User wants to select a container and an object and a group of objects

EX: I want to target Fruit / Apples / Golden Delicious and Fruit / Grapes / and Red Fruits NOT Apples

additionally, the ui needs to live in some kind of hideable state (modal/bottom sheet or side panel slideout, etc...) since it needs to be used by screens where space is a premium.

is there a pattern that I'm not thinking of? Leadership asked for everything to get dumped into a table full of checkboxes, but that doesn't address the multiple heirarchies...