class MastershipTermCodec extends JsonCodec<MastershipTerm> {

    @Override
    public ObjectNode encode(MastershipTerm term, CodecContext context) {
        checkNotNull(term, "Mastership term cannot be null");
        ObjectNode result = context.mapper().createObjectNode()
                .put(MASTER, term.master().id())
                .put(TERM_NUMBER, term.termNumber());

        return result;
    }

}