Refactor type and role validation into its own class for easier use in competitors' systems