package com.chuanxia.mcp.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

@Configuration
@EnableSwagger2 //开启seagger注解驱动
public class SwaggerConfig {

    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2).groupName("mcp")
                .apiInfo(getInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.chuanxia.mcp.controller"))
                .build();
    }

    private ApiInfo getInfo() {
        Contact contact = new Contact("李云天", "http://www.baidu.com", "2631125488@qq.com");
        return new ApiInfo("mcp后台管理系统", "包含cdn,ua后台", "1.1.0", "http://www.jd.com",
                contact, "川下科技", "http://www.aaa.com", new ArrayList<VendorExtension>());

    }
}
