package com.css.txw.mhzc.controller;

import com.css.ggzc.framework.common.pojo.CommonResult;
import com.css.txw.mhzc.pojo.QyrzReqDTO;
import com.css.txw.mhzc.pojo.YhxxbDTO;
import com.css.txw.mhzc.pojo.vo.*;
import com.css.txw.mhzc.service.TxwMhzcQyrzsqjlbService;
import com.css.txw.mhzc.service.TxwMhzcQyxxbService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Tag(name = "企业信息接口")
@RestController
@RequestMapping("/company")
@Validated
@Slf4j
public class CompanyController {

    @Resource
    private TxwMhzcQyxxbService qyxxbService;

    @Resource
    private TxwMhzcQyrzsqjlbService qyrzsqjlbService;

    @PostMapping("/register")
    @Operation(summary = "企业认证",description = "企业认证")
    public CommonResult<String> register(@RequestBody RegisterCompanyReqVO reqDTO){
        return CommonResult.success(qyxxbService.register(reqDTO));
    }

    @PostMapping("/qyRzSp")
    @Operation(summary = "企业认证审批",description = "企业认证审批")
    public CommonResult<String> qyRzSp(@RequestBody CompanySpReqVO reqVO){
        return CommonResult.success(qyxxbService.qyRzSp(reqVO));
    }
    @PostMapping("/intQyxxByDid")
  	@Operation(summary = "did企业认证信息",description ="did企业认证信息")
    public CommonResult<YhxxbDTO> intQyxxByDid(@RequestBody YhxxbDTO qyxx){
    	return CommonResult.success(qyxxbService.intQyxxByDid(qyxx));
    }
    
    @GetMapping("/revokeSq")
    @Operation(summary = "企业认证审批",description = "企业认证审批")
    public CommonResult<String> revokeSq(@RequestParam("uuid") String uuid){
        return CommonResult.success(qyrzsqjlbService.revokeSq(uuid));
    }

    @Operation(summary = "获取企业申请列表",description = "获取企业申请列表")
    @PostMapping("/getRegisterList")
    public CommonResult<List<RegisterCompanySqVO>> getRegisterList(@RequestBody GetRegisterListReqVO reqVO){
        return CommonResult.success(qyrzsqjlbService.getRegisterList(reqVO));
    }

    @Operation(summary = "获取企业申请列表",description = "获取企业申请列表")
    @PostMapping("/getCurrentRegisterList")
    public CommonResult<List<RegisterCompanySqVO>> getCurrentRegisterList(){
        return CommonResult.success(qyrzsqjlbService.getCurrentRegisterList());
    }

    @Operation(summary = "企业入驻",description = "企业入驻")
    @PostMapping("/qyrz")
    public CommonResult<String> qyrz(@RequestBody QyrzReqDTO reqDTO){
        return CommonResult.success(qyxxbService.qyrz(reqDTO));
    }

    @Operation(summary = "根据业务类型查询入驻的企业",description = "根据业务类型查询入驻的企业")
    @GetMapping("/getQyxxListByYwlx")
    public CommonResult<List<CompanyVO>> getQyxxListByYwlx(@RequestParam("ywlx") String ywlx){
        return CommonResult.success(qyxxbService.getQyxxListByYwlx(ywlx));
    }

}
