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 and selected internal/token endpoints are excluded from the documentation.
 */
@Configuration
public class OpenApiConfig {

    @Bean
    public GroupedOpenApi publicApi() {
        return GroupedOpenApi.builder()
                .group("public")
                .pathsToMatch("/**")
                .pathsToExclude(
                        "/api/admin/**",
                        "/api/users/deposit",
                        "/api/telegram/webhook/**",
                        "/api/tasks/daily-bonus",
                        "/api/tasks/daily-bonus/recent-claims",
                        "/api/payouts/create",
                        "/api/payouts/cancel",
                        "/api/notify_broadcast/**",
                        "/api/deposit_webhook/**",
                        "/api/auth/logout",
                        "/ping",
                        "/api/promotions",
                        "/api/promotions/**",
                        "/api/check_user/**"
                )
                .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"));
    }
}
