Replace pattern with enum