package at.procon.ted.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.info.License;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * OpenAPI/Swagger documentation configuration.
 * 
 * @author Martin.Schweitzer@procon.co.at and claude.ai
 */
@Configuration
public class OpenApiConfig {

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("TED Procurement Document API")
                        .version("1.0.0")
                        .description("""
                                REST API for searching and retrieving EU eForms public procurement documents 
                                from TED (Tenders Electronic Daily).
                                
                                ## Features
                                - **Structured Search**: Filter by country, CPV codes, dates, procedure types
                                - **Semantic Search**: Natural language queries using vector similarity
                                - **Document Retrieval**: Full document details with lots and organizations
                                
                                ## Authentication
                                Currently no authentication required (development mode).
                                
                                ## Rate Limits
                                No rate limits currently enforced.
                                """)
                        .contact(new Contact()
                                .name("PROCON DATA")
                                .email("Martin.Schweitzer@procon.co.at")
                                .url("https://www.procon.co.at"))
                        .license(new License()
                                .name("Proprietary")
                                .url("https://www.procon.co.at")))
                .servers(List.of(
                        new Server()
                                .url("/api")
                                .description("Local Development Server"),
                        new Server()
                                .url("https://ted-api.procon.co.at/api")
                                .description("Production Server")
                ));
    }
}
