package com.seer.teach.teacher.controller.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.servers.Server;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;


/**
 * @Author: Captain
 * @Autograph: 安稳
 * @Description: Swagger配置类
 * @Date: 2022-11-03 02:01:09
 */
@Configuration
@Profile({"local","dev","test"})
public class TeacherApiConfig {

    @Value("${server.servlet.context-path:/}")
    private String contextPath;

    @Bean
    public OpenAPI tvOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("Seer Teach Teacher API")
                        .description("此文档详细说明了Teacher模块接口规范")
                        .version("v1.0.0")
                        .contact(new Contact()
                                .name("广东用嘉研发部")
                                .url("http://localhost:8088")
                                .email("")))
                .addServersItem(new Server().url(contextPath));
    }

    @Bean
    public GroupedOpenApi teacherAppApi() {
        return GroupedOpenApi.builder()
                .group("teacher app api")
                .pathsToMatch("/app/**")
                .displayName("Seer Teach Teacher API")
                .build();
    }

    @Bean
    public GroupedOpenApi llmAppApi() {
        return GroupedOpenApi.builder()
                .group("llmApi")
                .pathsToMatch("/llm/**")
                .build();
    }
}