package com.usky.vpp.controller.web;

import com.usky.common.core.bean.ApiResult;
import com.usky.vpp.service.VppUnIntegrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 运管平台 UN 主动对接（Poll、注册、Token）
 * 网关前缀: /prod-api/service-vpp/un
 */
@RestController
@RequestMapping("/un")
public class UnIntegrationController {

    @Autowired
    private VppUnIntegrationService integrationService;

    @PostMapping("/token/refresh")
    public ApiResult<Map<String, Object>> refreshToken() {
        return ApiResult.success(integrationService.refreshToken());
    }

    @PostMapping("/register")
    public ApiResult<Map<String, Object>> register() {
        return ApiResult.success(integrationService.register());
    }

    @PostMapping("/poll")
    public ApiResult<Map<String, Object>> poll() {
        return ApiResult.success(integrationService.pollOnce());
    }
}
