/*
 * Copyright (c) 2023 codvision.com All Rights Reserved.
 */

package com.codvision.monitor.config;

import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * swagger配置
 *
 * @author lingee
 * @date 2023/11/7
 */
@EnableSwagger2
@EnableSwaggerBootstrapUI
@Configuration("monitorSwaggerConfig")
public class SwaggerConfig {

    @Bean
    public Docket monitorApiConfig() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(webApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.codvision.monitor"))
                .paths(PathSelectors.any())
                .build().groupName("监控中心服务");
    }

    private ApiInfo webApiInfo() {
        return new ApiInfoBuilder()
                .title("监控中心服务接口管理")
                .description("监控中心服务接口文档")
                .version("1.0")
                .license("Codvision")
                .licenseUrl("http://www.codvision.com")
                .build();
    }
}
