package com.sonymusic.dx.dxadvsearchservice.controllers;

import com.sonymusic.dx.dxadvsearchservice.model.ListModel;
import com.sonymusic.dx.dxadvsearchservice.model.RecordingProjectModel;
import com.sonymusic.dx.dxadvsearchservice.searchModel.RecordingProjectSearchModel;
import com.sonymusic.dx.dxadvsearchservice.service.RecordingProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;

@RestController
@RequestMapping("/projects")
public class RecordingProjectAdvSearchController {
    @Autowired
    private RecordingProjectService recordingProjectService;

    @PostMapping("/advSearchProject")
    public ListModel<RecordingProjectModel> getAdvSearchProjects(@RequestBody RecordingProjectSearchModel projects,
                                                        @RequestParam(defaultValue = "1")int page,
                                                        @RequestParam(defaultValue = "20")int size) throws ParseException {
        return recordingProjectService.advSearchProjects(projects,page,size);
    }
}
