package com.honey.honey.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springdoc.core.models.GroupedOpenApi;

/**
 * OpenAPI / Swagger configuration for the public API only.
 * Admin endpoints (/api/admin/**) are excluded from the documentation.
 */
@Configuration
public class OpenApiConfig {

    @Bean
    public GroupedOpenApi publicApi() {
        return GroupedOpenApi.builder()
                .group("public")
                .pathsToMatch("/**")
                .pathsToExclude("/api/admin/**")
                .build();
    }

    @Bean
    public OpenAPI honeyOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("Honey Public API")
                        .description("API for the Honey frontend. Admin panel endpoints are not included.")
                        .version("1.0"));
    }
}
