package cz.fi.muni.pa165.rest.controllers;

import cz.fi.muni.pa165.rest.ApiUris;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class MainController {

	final static Logger logger = LoggerFactory.getLogger(MainController.class);

	/**
	 * The main entry point of the REST API
	 * Provides access to all the resources with links to resource URIs
	 * Can be even extended further so that all the actions on all the resources are available
	 * and can be reused in all the controllers (possibly in full HATEOAS style)
	 *
	 * @return resources uris
	 */
	@RequestMapping(value = "/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public final Map<String, String> getResources() {
		return Map.of("products_uri", ApiUris.ROOT_URI_PRODUCTS,
				"orders_uri", ApiUris.ROOT_URI_ORDERS,
				"users_uri", ApiUris.ROOT_URI_USERS,
				"categories_uri", ApiUris.ROOT_URI_CATEGORIES);
	}
}
