package com.zcxk.gateway.config;


import lombok.AllArgsConstructor;
import org.springframework.cloud.gateway.config.GatewayProperties;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.ArrayList;
import java.util.List;


@Component
@Primary
@AllArgsConstructor
public class SwaggerProvider implements SwaggerResourcesProvider {

    public static final String API_URI = "/v2/api-docs";
    private final RouteLocator routeLocator;
    private final GatewayProperties gatewayProperties;




    @Override
    public List<SwaggerResource> get() {
        List resources = new ArrayList<>();
        resources.add(swaggerResource("用户服务接口", "/user-auth/v2/api-docs?group=api"));
        resources.add(swaggerResource("用户管理接口", "/user-center/v2/api-docs?group=api"));
        resources.add(swaggerResource("调度中心接口", "/sms-water/v2/api-docs?group=api"));
        resources.add(swaggerResource("运维管理接口", "/operation-manager/v2/api-docs?group=api"));
        resources.add(swaggerResource("消息中心接口", "/uims-message/v2/api-docs?group=api"));
        resources.add(swaggerResource("集抄中心接口", "/zoniot-rmcp-web/v2/api-docs?group=api"));
        resources.add(swaggerResource("调度中心接口新", "/zoniot-charge/v2/api-docs?group=api"));
        return resources;
    }

    private SwaggerResource swaggerResource(String name, String location) {
        SwaggerResource swaggerResource = new SwaggerResource();
        swaggerResource.setName(name);
        swaggerResource.setLocation(location);
        swaggerResource.setSwaggerVersion("2.0");
        return swaggerResource;

    }

}
