package com.inspect.ivs.controller;

import com.inspect.base.core.domain.Response;
import com.inspect.ivs.service.IvsCommonService;
import com.inspect.ivs.util.WebClientUtils;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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({"/domain"})
public class IvsDomainController {
    private static final Logger log = LoggerFactory.getLogger(IvsDomainController.class);
    private final IvsCommonService ivsCommonService;

    public IvsDomainController(IvsCommonService ivsCommonService) {
        this.ivsCommonService = ivsCommonService;
    }

    @GetMapping({"fresh"})
    public Response fresh() throws IOException {
        log.debug("==================fresh_domain=====================");
        WebClientUtils.refreshDomains();
        log.debug("==================domains:{}", WebClientUtils.domains);
        log.debug("==================fresh_domain_end=====================");
        return Response.ok();
    }
}
