package com.ease.gsms.server.model.util;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

public class IDEnumSerializer extends JsonSerializer<IDEnum> {

    @Override
    public void serialize(IDEnum idEnum, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        jsonGenerator.writeStartObject();
        jsonGenerator.writeNumberField(idEnum.name(), idEnum.getId());
        jsonGenerator.writeEndObject();
    }

}
