package thyyxxk.webserver.controller.search;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.dictionary.SearchDataParam;
import thyyxxk.webserver.service.search.SearchService;

import java.util.Map;

@RestController
@RequestMapping("/search")
public class SearchController {
    private final SearchService service;

    @Autowired
    public SearchController(SearchService service) {
        this.service = service;
    }

    @PostMapping("/execute")
    public ResultVo<Map<String, Object>> execute(@RequestBody @Validated SearchDataParam params) {
        return service.execute(params);
    }
}
