package com.seer.teach.pay.app.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;

@Configuration
@Profile({"local","dev","test"})
public class PayApiConfig {


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

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

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