package gov.samhsa.c2s.c2suiapi.web;

import gov.samhsa.c2s.c2suiapi.infrastructure.PlsClient;
import gov.samhsa.c2s.c2suiapi.infrastructure.PlsService;
import gov.samhsa.c2s.c2suiapi.infrastructure.dto.FlattenedSmallProviderDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.PagedResources;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PlsRestController implements PlsService {

    @Autowired
    private PlsClient plsClient;

    @Override
    public PagedResources<FlattenedSmallProviderDto> searchProviders(
            @RequestParam(value = "state", required = false) String state,
            @RequestParam(value = "city", required = false) String city,
            @RequestParam(value = "zipcode", required = false) String zipCode,
            @RequestParam(value = "firstname", required = false) String firstName,
            @RequestParam(value = "lastname", required = false) String lastName,
            @RequestParam(value = "gendercode", required = false) String genderCode,
            @RequestParam(value = "orgname", required = false) String orgName,
            @RequestParam(value = "phone", required = false) String phone,
            @RequestParam(value = "page", required = false) String page,
            @RequestParam(value = "size", required = false) String size,
            @RequestParam(value = "sort", required = false) String sort,
            @RequestParam(value = "projection", defaultValue = Projection.FLATTEN_SMALL_PROVIDER) String projection,
            @RequestHeader(X_FORWARDED_PROTO) String xForwardedProto,
            @RequestHeader(X_FORWARDED_HOST) String xForwardedHost,
            @RequestHeader(X_FORWARDED_PREFIX) String xForwardedPrefix,
            @RequestHeader(X_FORWARDED_PORT) int xForwardedPort) {
        return plsClient.searchProviders(state, city, zipCode, firstName, lastName, genderCode,
                orgName, phone, page, size, sort, projection, xForwardedProto, xForwardedHost, xForwardedPrefix, xForwardedPort);
    }
}
@@ -399,16 +399,79 @@
 Header;%0A
+import org.springframework.web.bind.annotation.RequestMapping;%0A
 import o
@@ -603,16 +603,40 @@
 troller%0A
+@RequestMapping(%22/pls%22)%0A
 public c
@@ -2266,16 +2266,31 @@
 edPrefix
+.concat(%22/pls%22)
 , xForwa

Add base url to call pls core service