Encodes a value of type T to the storage type TStore.
T
TStore
@override int encode(T value) => value.index;