package com.lingniu.ingest.vehiclestate;

import java.util.Optional;

final class InMemoryVehicleStateRepository implements VehicleStateRepository {
    String state;
    String location;
    String safety;
    String lastEvent;

    @Override
    public void putState(String vin, String json) {
        this.state = json;
    }

    @Override
    public void putLocation(String vin, String json) {
        this.location = json;
    }

    @Override
    public void putSafety(String vin, String json) {
        this.safety = json;
    }

    @Override
    public void putLastEvent(String vin, String json) {
        this.lastEvent = json;
    }

    @Override
    public Optional<String> getState(String vin) {
        return Optional.ofNullable(state);
    }

    @Override
    public Optional<String> getLocation(String vin) {
        return Optional.ofNullable(location);
    }

    @Override
    public Optional<String> getSafety(String vin) {
        return Optional.ofNullable(safety);
    }

    @Override
    public Optional<String> getLastEvent(String vin) {
        return Optional.ofNullable(lastEvent);
    }
}
