package shop.alien.storeplatform.controller;

import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import shop.alien.entity.result.R;
import shop.alien.storeplatform.service.MerchantAuthService;

/**
 * web端商户身份验证管理 前端控制器
 *
 * @author ssk
 * @since 2025-01-xx
 */
@Slf4j
@Api(tags = {"web端商户身份验证管理"})
@ApiSort(2)
@CrossOrigin
@RestController
@RequestMapping("/merchantAuth")
@RequiredArgsConstructor
public class MerchantAuthController {

    private final MerchantAuthService merchantAuthService;

    @ApiOperation("身份证二要素核验")
    @ApiOperationSupport(order = 1)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "姓名", dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "idCard", value = "身份证号", dataType = "String", paramType = "query", required = true),
            @ApiImplicitParam(name = "appType", value = "端区分(0:用户, 1:商家)", dataType = "Integer", paramType = "query", required = true, defaultValue = "1")
    })
    @GetMapping("/verifyIdInfo")
    public R<String> verifyIdInfo(@RequestParam("name") String name, 
                          @RequestParam("idCard") String idCard, 
                          @RequestParam("appType") Integer appType) {
        log.info("MerchantAuthController.verifyIdInfo?name={}&idCard={}&appType={}", name, idCard, appType);
        return merchantAuthService.verifyIdInfo(name, idCard, appType);
    }
}

