package com.ga.api.controller.internal;

import com.ga.api.service.withdraw.WithdrawBankSettleService;
import com.ga.common.annotation.RequirePermission;
import com.ga.common.model.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 펌뱅킹 SETTLED 동기화 수동 트리거.
 * cron 활성화 환경에서는 자동 실행되지만 운영 중 즉시 입금 확정 동기화가 필요할 때 사용.
 */
@Tag(name = "내부 트리거")
@RestController
@RequestMapping("/api/internal/bank-settle")
@RequiredArgsConstructor
public class BankSettleController {

    private final WithdrawBankSettleService bankSettleService;

    @PostMapping
    @RequirePermission(menu = "WITHDRAW", perm = "EXECUTE")
    public ApiResponse<Integer> sync() {
        return ApiResponse.ok(bankSettleService.syncOnce());
    }
}
