package com.sqx.modules.sendRecord.controller;


import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.resumes.entity.PostPush;
import com.sqx.modules.resumes.entity.Resumes;
import com.sqx.modules.sendRecord.entity.SendRecord;
import com.sqx.modules.sendRecord.service.SendRecordService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 投递记录
 * </p>
 *
 * @author wuchang
 * @since 2023-02-02
 */
@RestController
@RequestMapping("/app/sendRecord/")
public class SendRecordController {

    @Autowired
    private SendRecordService recordService;

    @Login
    @ApiOperation("获取我的投递列表V2")
    @GetMapping(value = "getMyRecordListV2")
    public Result getMyRecordListV2(@RequestAttribute("userId") Long userId, Integer page, Integer limit, SendRecord sendRecord, PostPush postPush) {
        sendRecord.setUserId(userId);
        return Result.success().put("data", recordService.getMyRecordListV2(page, limit, sendRecord, postPush));
    }

    @Login
    @ApiOperation("获取我的投递列表")
    @GetMapping(value = "getMyRecordList")
    public Result getRecordList(@RequestAttribute("userId") Long userId, Integer page, Integer limit, SendRecord sendRecord) {
        sendRecord.setUserId(userId);
        return Result.success().put("data", recordService.getRecordList(page, limit, sendRecord));
    }

    @Login
    @ApiOperation("企业获取投递列表V2")
    @GetMapping(value = "getCompanyRecordListV2")
    public Result getCompanyRecordList(@RequestAttribute("userId") Long userId, Integer page, Integer limit, SendRecord sendRecord, Resumes resumes) {
        sendRecord.setCompanyUserId(userId);
        return Result.success().put("data", recordService.getCompanyRecordListV2(page, limit, sendRecord, resumes));
    }

    @Login
    @ApiOperation("企业获取投递列表")
    @GetMapping(value = "getCompanyRecordList")
    public Result getCompanyRecordList(@RequestAttribute("userId") Long userId, Integer page, Integer limit, SendRecord sendRecord) {
        sendRecord.setCompanyUserId(userId);
        return Result.success().put("data", recordService.getRecordList(page, limit, sendRecord));
    }

    @Login
    @ApiOperation("将面试记录设置为已读")
    @GetMapping(value = "seeRecord")
    public Result seeRecord(Long recordId) {
        return recordService.seeRecord(recordId);
    }

}

