change type and state to enum