A complexity reduction approach to detectability of switching systems