package com.cyl.h5.controller.staff;

import com.alibaba.fastjson.JSON;
import com.cyl.h5.pojo.request.*;
import com.cyl.manager.staff.domain.vo.StaffVO;
import com.cyl.manager.staff.service.IStaffService;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


//@Api("员工")
@RestController
@Slf4j
@RequestMapping("/h5/companion/staff")
public class H5PetCompanionController {


    @Autowired
    private IStaffService staffService;
    /**
     * 加入合伙人
     * @return
     */
    @PostMapping("/joinPartner")
    public AjaxResult joinPartner(){
        return AjaxResult.success(staffService.joinPartner());
    }


    /**
     * 获取员工信息
     * @return
     */
    @GetMapping("/getStaffInfo")
    public AjaxResult getStaffInfo() {
        return AjaxResult.successData(staffService.getH5StaffInfo());
    }


    /**
     * 保存喂养员认证基本信息，入驻使用
     * @return
     */
    @PostMapping("/saveBaseInfo")
//    @ApiOperation(value = "保存喂养员认证基本信息", notes = "保存喂养员认证基本信息")
    public AjaxResult saveBaseInfo(@RequestBody @Validated StaffAuthenticateBaseInfoRequest request){
        log.info("保存伴宠师基本信息,请求参数:{}", JSON.toJSONString(request));
        return AjaxResult.success(staffService.saveBaseInfo(request));
    }

    /**
     * 提交基础答题结果
     * @return
     */
    @PostMapping("/submitBasicCheckResult")
//    @ApiOperation(value = "保存基础考核答题结果", notes = "保存基础考核答题结果")
    public AjaxResult submitBasicCheckResult(@RequestBody @Validated BasicCheckResultRequest request){
        log.info("保存基础考核答题结果,请求参数:{}", JSON.toJSONString(request));
        return AjaxResult.success(staffService.submitBasicCheckResult(request));
    }


    @PostMapping("/submitTrainCheckAnswer")
//    @ApiOperation(value = "保存培训考核答案", notes = "保存培训考核答案")
    public AjaxResult submitTrainCheckAnswer(@RequestBody @Validated TrainCheckAnswerRequest request){
        log.info("保存培训考核答案,请求参数:{}", JSON.toJSONString(request));
        return AjaxResult.success(staffService.submitTrainCheckAnswer(request));
    }

    /**
     * 获取基础考核题目
     * @return
     */
    @GetMapping("/getBasicQuestion")
//    @ApiOperation(value = "获取基础考核题目", notes = "获取基础考核题目")
    public AjaxResult getBasicQuestion(){
        return AjaxResult.success(staffService.getBasicQuestion());
    }


    /**
     * 获取培训考核题目
     * @return
     */
    @GetMapping("/getTrainQuestion")
//    @ApiOperation(value = "获取培训考核题目", notes = "获取培训考核题目")
    public AjaxResult getTrainQuestion(){
        return AjaxResult.success(staffService.getTrainQuestion());
    }




    /**
     * 根据员工id查询最新培训考核答题记录
     * @return
     */
    @GetMapping("/getTrainAnswerRecord")
//    @ApiOperation(value = "根据员工id查询最新培训考核答题记录", notes = "根据员工id查询最新培训考核答题记录")
    public AjaxResult getTrainAnswerRecord(@RequestParam("staffId") Long staffId){
        return AjaxResult.success(staffService.getTrainAnswerRecord(staffId));
    }


    /**
     * 完善服务信息
     * @return
     */
    @PostMapping("/completeServiceInfo")
//    @ApiOperation(value = "完善服务信息", notes = "完善服务信息")
    public AjaxResult completeServiceInfo(@RequestBody @Validated StaffServiceInfoRequest request){
        log.info("完善服务信息,请求参数:{}", JSON.toJSONString(request));
        return AjaxResult.success(staffService.completeServiceInfo(request));
    }

    /**
     * 修改接单状态
     * @return
     */
    @PostMapping("/changeReceiveOrderStatus")
//    @ApiOperation(value = "修改接单状态", notes = "修改接单状态")
    public AjaxResult changeReceiveOrderStatus(@RequestBody @Validated StaffChangeReceiveOrderStatusRequest request){
        log.info("修改接单状态,请求参数:{}", JSON.toJSONString(request));
        return AjaxResult.success(staffService.changeReceiveOrderStatus(request));
    }

    /**
     * 点赞
     * @return
     */
    @PostMapping("/star")
//    @ApiOperation(value = "点赞", notes = "点赞")
    public AjaxResult star(@RequestBody @Validated StaffStarRequest request){
        log.info("点赞,请求参数:{}", JSON.toJSONString(request));
        return AjaxResult.success(staffService.star(request));
    }



}
