package com.example.demo.data;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.demo.model.Location;

@Controller
public class Controller0 {

	// tutaj kontroler odwołuje się bezpośrednio do repozytorium z pominięciem warstwy usług
	@Autowired
	private Repository0_Memory repository;
	
	@GetMapping(path="/memory/location", produces="text/plain")
	@ResponseBody
	public String location() {
		Location location = repository.dajLokalizacje();
		
		return location.getStreetAddress() + " " + location.getCity();
	}
	
}
