package io.delphiplatform.api.v3.view;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.delphiplatform.api.v3.bigtable.BigtableAmazonStationsStreamsService;
import io.delphiplatform.api.v3.model.amazon.AmazonStationsStreamsResults;
import io.delphiplatform.api.v3.view.util.Params;
import lombok.NonNull;

@RestController
@RequestMapping("${spring.data.rest.base-path:/v3}")
public class StationsController implements StationsApi {

    private final BigtableAmazonStationsStreamsService amazonStationsStreamsService;

    @Autowired
    public StationsController(
        BigtableAmazonStationsStreamsService amazonStationsStreamsService
    ) {
        this.amazonStationsStreamsService = amazonStationsStreamsService;
    }

    @Override
    public ResponseEntity<AmazonStationsStreamsResults> getAmazonStationsStreams(@NonNull Params params) {
        return ResponseEntity.ok(
            amazonStationsStreamsService.getAmazonStationsStreams(params)
        );
    }
}
