package com.hzs.system.tools.controller.api;

import com.hzs.common.core.web.domain.AjaxResult;
import com.hzs.system.tools.service.IIdempotentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/idempotent")
@Slf4j
public class ApiIdempotentController {

    private IIdempotentService idempotentService;

    @Autowired
    public void setIdempotentService(IIdempotentService idempotentService) {
        this.idempotentService = idempotentService;
    }

    @GetMapping("/generate")
    public AjaxResult generateIdempotentToken() {
        return AjaxResult.success(idempotentService.generateToken());
    }

}
