A defense-offense multi-layered regulatory switch in a pathogenic bacterium