The drain coming from the main floor toilet comes through the basement ceiling and I was going to just add a 90, then a 5 foot horizontal run before it will enter a san-tee that I will add to an existing vertical stack which goes to a second story bath.

Instead of the 90 can I install a wye on it's back, add a 45 to connect the toilet, the downstream of the wye will connect to my 5 foot run and on the other end of the wye I was going to extend it a foot longer and add a cleanout. Is adding a cleanout as I described a good idea and is it allowed as I described?

Thanks.