Tree like multi selection

Hi everybody

I need to create a tree selection like UI, which looks/works like this:
Bildschirmfoto 2023-12-16 um 13.09.31

It also needs just a parent and a child (the children need to be multi select). Has anybody a good way to do this also an alternative UI with the same functionality would be a way to go. It just needs to be possible to easily select groups etc.