package jnpf.personnels.controller.web.rewardspunishments;

import jnpf.base.ActionResult;
import jnpf.model.personnels.dto.rewardspunishments.FtbAwardPassedDTO;
import jnpf.model.personnels.dto.rewardspunishments.FtbAwardSubmissionDTO;
import jnpf.model.personnels.dto.rewardspunishments.FtbPenaltySubmissionDTO;
import jnpf.personnels.service.FtbRewardsPunishmentsApproveOAService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 奖惩OA审批回调
 *
 * @author wangchunxiang
 * @date 2024/08/14
 */
@RestController
@RequestMapping("/approve-oa")
public class FtbRewardsPunishmentsApproveOAController {

    @Resource
    private FtbRewardsPunishmentsApproveOAService ftbRewardsPunishmentsApproveOAService;

    /**
     * 奖项提交事件
     *
     * @return {@link ActionResult }
     */
    @PostMapping("/award-submission")
    public ActionResult awardSubmission(@RequestBody @Validated FtbAwardSubmissionDTO ftbAwardSubmission) {
        ftbRewardsPunishmentsApproveOAService.awardSubmission(ftbAwardSubmission);
        return ActionResult.success();
    }

    /**
     * 奖项通过/拒绝/撤回事件
     *
     * @return {@link ActionResult }
     */
    @PostMapping("/award-passed")
    public ActionResult awardPassed(@RequestBody @Validated FtbAwardPassedDTO ftbAwardPassedDTO) {
        ftbRewardsPunishmentsApproveOAService.awardPassed(ftbAwardPassedDTO);
        return ActionResult.success();
    }

    /**
     * 惩罚提交事件
     *
     * @return {@link ActionResult }
     */
    @PostMapping("/penalty-submission")
    public ActionResult penaltySubmission(@RequestBody @Validated FtbPenaltySubmissionDTO ftbPenaltySubmissionDTO) {
        ftbRewardsPunishmentsApproveOAService.penaltySubmission(ftbPenaltySubmissionDTO);
        return ActionResult.success();
    }

    /**
     * 惩罚通过/拒绝/撤回事件
     *
     * @return {@link ActionResult }
     */
    @PostMapping("/penalty-passed")
    public ActionResult penaltyPassed(@RequestBody @Validated FtbAwardPassedDTO ftbAwardPassedDTO) {
        ftbRewardsPunishmentsApproveOAService.penaltyPassed(ftbAwardPassedDTO);
        return ActionResult.success();
    }

}
