package ru.micord.ervu.journal.deserializer;

import java.io.IOException;
import java.time.LocalDateTime;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import ru.micord.ervu.util.DateUtils;

public class DepartureDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {

  @Override
  public LocalDateTime deserialize(JsonParser jsonParser,
      DeserializationContext deserializationContext) throws IOException {
    String dateTimeString = jsonParser.getText();
    return DateUtils.convertToLocalDateTime(dateTimeString);
  }
}
