func (v *ContactType) UnmarshalJSON(b []byte) error {
	if len(b) > 2 && b[0] == '"' && b[len(b)-1] == '"' {
		return v.UnmarshalText(b[1 : len(b)-1])
	}
	i, err := strconv.Atoi(string(b))
	if err != nil {
		return errCouldNotParse("ContactType")(string(b)).WithCause(err)
	}
	*v = ContactType(i)
	return nil
}
UnmarshalJSON implements json.Unmarshaler interface.
package ttnpb
import (
	"strconv"
	"strings"
)
func (v ContactType) MarshalText() ([]byte, error) {
	return []byte(v.String()), nil
}
func (v *ContactType) UnmarshalText(b []byte) error {
	s := string(b)
	if i, ok := ContactType_value[s]; ok {
		*v = ContactType(i)
		return nil
	}
	if !strings.HasPrefix(s, "CONTACT_TYPE_") {
		if i, ok := ContactType_value["CONTACT_TYPE_"+s]; ok {
			*v = ContactType(i)
			return nil
		}
	}
	return errCouldNotParse("ContactType")(string(b))
}