Bulk of constraint enforcement code, "best" suggestions.

Wrote getValidTypes() which builds a list of EditTypes that
can be inserted given a AugmentedEntity state, which is our
mechanism for enforcing ContactsSource constraints.  This
also drives canInsert(), which provides the enabled state
for our "add" buttons.

This change also reintroduces "suggested" types, used to
pick the default EditType for newly added entries.  It picks
the first primary type that doesn't already appear, or
otherwise picks the last primary type.  (This gives us a
nice "add" transition down the list of possible types.)

Finally, this change connects all of this logic into the
UI, picking available labels and enabling "add" according
to any constraints.  Also wrote unit tests to verify the
above code is producing the expected results.  These tests
exercise the backbone of our constraint-enforcement logic.
6 files changed