[feature] implement state switch.