package com.backendsys.modules.common.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

@Configuration
public class SpringDocConfig {

    @Value("${HTTP_BASE_URI}")
    private String HTTP_BASE_URI;

    @Bean
    public OpenAPI customOpenAPI(Environment environment) {
        return new OpenAPI()
            .info(new Info()
                    .title("SpringDoc API Documentation")
//                    .version("v1")
//                    .description("SpringDoc API Documentation Description"))
            )
            .addServersItem(new Server().url(HTTP_BASE_URI))
            .components(new Components());
    }

}
