content: /*
   * Copyright (c) 2023 Airbyte, Inc., all rights reserved.
   */
  
  package io.airbyte.integrations.source.postgres.cdc;
  
  import com.fasterxml.jackson.databind.JsonNode;
  import io.airbyte.cdk.integrations.debezium.CdcSavedInfoFetcher;
  import io.airbyte.cdk.integrations.debezium.internals.AirbyteSchemaHistoryStorage.SchemaHistory;
  import io.airbyte.cdk.integrations.source.relationaldb.models.CdcState;
  import java.util.Optional;
  
  public class PostgresCdcSavedInfoFetcher implements CdcSavedInfoFetcher {
  
    private final JsonNode savedOffset;
  
    public PostgresCdcSavedInfoFetcher(final CdcState savedState) {
      final boolean savedStatePresent = savedState != null && savedState.getState() != null;
      this.savedOffset = savedStatePresent ? savedState.getState() : null;
    }
  
    @Override
    public JsonNode getSavedOffset() {
      return savedOffset;
    }
  
    @Override
    public SchemaHistory<Optional<JsonNode>> getSavedSchemaHistory() {
      throw new RuntimeException("Schema history is not relevant for Postgres");
    }
  
  }
  