package com.yida.data.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.system.EduSchoolInquireCommonQuestion;
import com.yida.data.system.service.EduInquireQuestionService;
import com.yida.data.system.vo.FindPhonePageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
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;

/**
 * @author ccl
 */
@Slf4j
@Validated
@Api(tags = "入学咨询（无鉴权）")
@RestController
@RequestMapping("/in/inquire")
@RequiredArgsConstructor
public class InEduInquireController {

    private final EduInquireQuestionService inquireService;

    @ApiOperation("常见问题列表")
    @GetMapping("/findQuestionPage")
    public ResultBean<IPage<EduSchoolInquireCommonQuestion>> findQuestionPage(@RequestParam (required = false)@ApiParam("标签id") Long labelId,
                                                                              @RequestParam  @ApiParam("部门id") Long deptId,
                                                                              @RequestParam (required = false,defaultValue = "1")Integer pageNum,
                                                                              @RequestParam (required = false,defaultValue = "10")Integer pageSize) {

        Page page = new Page<>();
        page.setSize(pageSize);
        page.setCurrent(pageNum);
        return ResultBean.buildSuccess(inquireService.findQuestionPage(labelId,deptId,page,null));
    }

    @ApiOperation("咨询电话列表")
    @GetMapping("/findPhonePage")
    public ResultBean<IPage<FindPhonePageVO>> findPhonePage(@RequestParam (required = false)@ApiParam("标签id") Long labelId,
                                                            @RequestParam  @ApiParam("部门id") Long deptId,
                                                            @RequestParam (required = false,defaultValue = "1")Integer pageNum,
                                                            @RequestParam (required = false,defaultValue = "10")Integer pageSize) {

        Page page = new Page<>();
        page.setSize(pageSize);
        page.setCurrent(pageNum);
        return ResultBean.buildSuccess(inquireService.findPhonePage(labelId,deptId,page,null));
    }
}
