Depends on the creative interpretation of the code. Separation and the like would apply, however the installation of an electrical enclosure within an enclosure would usually be a faux pax. No different, barring some voltage and separation, than installing a breaker enclosure within another existing enclosure.
Best option is to have the unit be it's own entity.