package net.northking.cctp.se.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
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;

/**
 * @author xiusong.xie
 * @since 2.4
 */
@Configuration
public class SwaggerConfiguration implements WebMvcConfigurer {
  /**
   * 接口文档定义
   *
   * @return 接口文档定义
   */
  @Bean
  public Docket createRestApi() {
    ApiInfo apiInfo = new ApiInfoBuilder()
            .title("UI引擎服务")
            .description("这是UI引擎服务的接口文档")
            .version("1.0")
            .build();
    return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any()).build();
  }
}