package com.izouma.nineth.web.mobile.open.v1;


import com.izouma.nineth.dto.CaptchaDTO;
import com.izouma.nineth.enums.CaptchaType;
import com.izouma.nineth.service.CustomCaptchaService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/captcha/v1")
@AllArgsConstructor
public class CaptchaControllerOpenV1 {
    private final CustomCaptchaService customCaptchaService;

    /**
     * 自定义的计算验证码
     * @return
     * @throws Exception
     */
    @PostMapping("/getCustom")
    public CaptchaDTO getCustom() throws Exception {
        return customCaptchaService.gen(CaptchaType.ARITHMETIC, 2);
    }

}
