package com.muyu.data.mart.controller;

import com.muyu.common.core.domain.Result;
import com.muyu.data.mart.common.BasicApi;
import com.muyu.data.mart.domain.realname.RealNameReq;
import com.muyu.data.mart.domain.realname.RealNameResp;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
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;

/**
 * @Author：chaiyapeng
 * @Package：com.muyu.data.mart.controller
 * @Project：cloud-port
 * @name：ApiUserController
 * @Date：2024/9/9 17:14
 */
@RestController
@RequestMapping("/api")
@Log4j2
@Tag(name = "接口调用",description = "进行不同接口调用")
public class ApiUserController {

    @Resource(name = "api-real-name")
    private BasicApi<RealNameReq, RealNameResp> realNameService;


    public ApiUserController(BasicApi<RealNameReq, RealNameResp> realNameService){
        this.realNameService = realNameService;
    }

    @PostMapping("/realname")
    @Operation(summary = "实名认证",description = "实名认证")
    public Result RealName(@RequestBody RealNameReq realNameReq) {
        RealNameResp realNameResp = null;
        try {
            realNameResp = realNameService.send(realNameReq);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return Result.success(realNameResp);
    }
}
