package com.utopiaindustries.restcontroller;

import com.utopiaindustries.model.uind.LocationSite;
import com.utopiaindustries.service.LocationService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping( "/rest/locations" )
public class LocationRestController {

    private final LocationService locationService;

    public LocationRestController(LocationService locationService) {
        this.locationService = locationService;
    }

    @GetMapping("/sites/search")
    private List<LocationSite> searchSiteByTitle(@RequestParam String term ) {
        return locationService.getSitesByTitle( term );
    }

}
