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

package com.codvision.auth.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("authCenterSwaggerConfig")
public class SwaggerConfig {

    @Bean
    public Docket authCenterApiConfig() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(webApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.codvision.auth"))
                .paths(PathSelectors.any())
                .build().groupName("统一认证中心");
    }

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