package com.ningdatech.pmapi.expert.controller;


import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.expert.manage.ExpertMetaApplyManage;
import com.ningdatech.pmapi.expert.model.cmd.MetaApplyListQuery;
import com.ningdatech.pmapi.expert.model.req.MetaApplyResultRequest;
import com.ningdatech.pmapi.expert.model.vo.ExpertApplyMetaVO;
import com.ningdatech.pmapi.expert.model.vo.MetaApplyResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Liuxinxin
 * @since 2023-03-01
 */
@RestController
@RequestMapping("/api/v1/apply/meta/")
@Validated
@RequiredArgsConstructor
@Api(value = "ExpertMetaApplyController", tags = "专家申请管理相关接口")
public class ExpertMetaApplyController {

    private final ExpertMetaApplyManage expertMetaApplyManage;

    @PostMapping("/list")
    @ApiOperation(value = "审核列表筛选")
    public PageVo<ExpertApplyMetaVO> metaApplyListQuery(@RequestBody @Valid MetaApplyListQuery metaApplyListQuery) {
//        ExpertMetaApplyValidator.metaApplyListQueryValidate(metaApplyListQuery);
        return expertMetaApplyManage.metaApplyListQuery(metaApplyListQuery);
    }

    @PostMapping("/result")
    @ApiOperation(value = "审核结果处理")
    public void metaApplyResult(@RequestBody @Valid MetaApplyResultRequest applyResultRequest) {
        expertMetaApplyManage.metaApplyResult(applyResultRequest);
    }

    @PostMapping("/revoke/{applyId}")
    @ApiOperation(value = "申请撤销")
    public void metaApplyRevoke(@PathVariable Long applyId) {
        expertMetaApplyManage.metaApplyRevoke(applyId);
    }

    @ApiOperation("申请审核详情")
    @GetMapping("/detail/{applyId}")
    public MetaApplyResultVo applyAuditDetail(@PathVariable Long applyId) {
        return expertMetaApplyManage.metaApplyResult(applyId);
    }


}
