package com.ruoyi.cms.controller.app;

import com.ruoyi.cms.domain.rc.PublicJobFairCompanyVO;
import com.ruoyi.cms.domain.rc.PublicJobFairDetail;
import com.ruoyi.cms.domain.rc.PublicJobFairQuery;
import com.ruoyi.cms.domain.rc.PublicJobFairResponse;
import com.ruoyi.cms.service.rc.IPublicJobFairService;
import com.ruoyi.common.annotation.BussinessLog;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 公共招聘会Controller（石河子）
 */
@Slf4j
@RestController
@RequestMapping("/app/jobfair/public/jobfair")
@Api(tags = "公共接口：招聘会（石河子）")
public class PublicJobFairController extends BaseController {

    @Autowired
    private IPublicJobFairService publicJobFairService;

    /**
     * 分页查询招聘会列表
     */
    @BussinessLog(title = "公共招聘会列表")
    @ApiOperation("分页查询招聘会列表")
    @GetMapping("/page")
    public PublicJobFairResponse page(PublicJobFairQuery query) {
        return publicJobFairService.getJobFairPage(query);
    }

    /**
     * 获取招聘会详情
     */
    @BussinessLog(title = "公共招聘会详情")
    @ApiOperation("获取招聘会详情")
    @GetMapping("/detail")
    public AjaxResult detail(@ApiParam("招聘会ID") @RequestParam String jobFairId) {
        PublicJobFairDetail detail = publicJobFairService.getJobFairDetail(jobFairId);
        return success(detail);
    }

    /**
     * 获取招聘会企业及岗位列表
     */
    @BussinessLog(title = "招聘会企业及岗位列表")
    @ApiOperation("获取招聘会企业及岗位列表")
    @GetMapping("/enterprises-with-jobs-by-job-fair-id")
    public AjaxResult enterprisesWithJobs(@ApiParam("招聘会ID") @RequestParam String jobFairId) {
        List<PublicJobFairCompanyVO> list = publicJobFairService.getEnterprisesWithJobs(jobFairId);
        return success(list);
    }
}
