package com.fzm.mall.server.front.config;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
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;

/**
 * @author lyz
 * @mail lyz@disanbo.com
 * @create 2021/1/25 9:56
 * @description
 */
@Configuration
@EnableSwagger2
@EnableKnife4j
public class Knife4jApiDoc {

    @Bean
    public Docket docketApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("商城前台接口")
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }

    @Bean
    public ApiInfo apiInfo(){
        return new ApiInfoBuilder()
                .title("商城前台接口文档")
                .version("1.0.0")
                .description("复杂美自研商城前台服务端接口文档")
                .termsOfServiceUrl("http://www.33.cn")
                .build();
    }
}
