package com.hertz.modules.system.controller;

import com.hertz.common.api.ApiResponse;
import com.hertz.modules.system.dto.AuthDtos;
import com.hertz.modules.system.service.CaptchaService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/auth/captcha")
public class CaptchaController {

  private final CaptchaService captchaService;

  public CaptchaController(CaptchaService captchaService) {
    this.captchaService = captchaService;
  }

  @GetMapping
  public ApiResponse<AuthDtos.CaptchaResponse> getCaptcha() {
    var res = captchaService.generateCaptcha();
    return ApiResponse.ok(res);
  }
}
