package net.mcreator.customoregen.config;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

/**
 * Unit tests for ModConfigs
 *
 * Tests the configuration system structure and default values.
 * Note: Config values require the NeoForge environment to be loaded,
 * so these tests focus on structure validation.
 */
@DisplayName("ModConfigs Tests")
class ModConfigsTest {

    @Test
    @DisplayName("Config class should exist")
    void testConfigClass_ShouldExist() {
        assertNotNull(ModConfigs.class, "ModConfigs class should exist");
    }

    @Test
    @DisplayName("Config class should be public")
    void testConfigClass_ShouldBePublic() {
        assertTrue(java.lang.reflect.Modifier.isPublic(ModConfigs.class.getModifiers()),
                "ModConfigs should be public");
    }

    @Test
    @DisplayName("Config class should have inner classes")
    void testConfigInnerClasses_ShouldExist() {
        assertDoesNotThrow(() -> {
            Class<?>[] innerClasses = ModConfigs.class.getDeclaredClasses();
            assertTrue(innerClasses.length > 0, "Should have inner classes");
        });
    }

    @Test
    @DisplayName("Config should have OreGenConfig inner class")
    void testOreGenConfigClass_ShouldExist() {
        assertDoesNotThrow(() -> {
            Class<?>[] innerClasses = ModConfigs.class.getDeclaredClasses();
            assertTrue(java.util.Arrays.stream(innerClasses)
                    .anyMatch(c -> c.getSimpleName().equals("OreGenConfig")),
                    "Should have OreGenConfig inner class");
        });
    }

    @Test
    @DisplayName("Config should have ToolStatsConfig inner class")
    void testToolStatsConfigClass_ShouldExist() {
        assertDoesNotThrow(() -> {
            Class<?>[] innerClasses = ModConfigs.class.getDeclaredClasses();
            assertTrue(java.util.Arrays.stream(innerClasses)
                    .anyMatch(c -> c.getSimpleName().equals("ToolStatsConfig")),
                    "Should have ToolStatsConfig inner class");
        });
    }

    @Test
    @DisplayName("Config should have DropsConfig inner class")
    void testDropsConfigClass_ShouldExist() {
        assertDoesNotThrow(() -> {
            Class<?>[] innerClasses = ModConfigs.class.getDeclaredClasses();
            assertTrue(java.util.Arrays.stream(innerClasses)
                    .anyMatch(c -> c.getSimpleName().equals("DropsConfig")),
                    "Should have DropsConfig inner class");
        });
    }

    @Test
    @DisplayName("Config should have FeatureToggleConfig inner class")
    void testFeatureToggleConfigClass_ShouldExist() {
        assertDoesNotThrow(() -> {
            Class<?>[] innerClasses = ModConfigs.class.getDeclaredClasses();
            assertTrue(java.util.Arrays.stream(innerClasses)
                    .anyMatch(c -> c.getSimpleName().equals("FeatureToggleConfig")),
                    "Should have FeatureToggleConfig inner class");
        });
    }

    @Test
    @DisplayName("Inner config classes should be accessible")
    void testInnerConfigClasses_ShouldBeAccessible() {
        assertDoesNotThrow(() -> {
            assertNotNull(ModConfigs.OreGenConfig.class, "OreGenConfig should be accessible");
            assertNotNull(ModConfigs.ToolStatsConfig.class, "ToolStatsConfig should be accessible");
            assertNotNull(ModConfigs.DropsConfig.class, "DropsConfig should be accessible");
            assertNotNull(ModConfigs.FeatureToggleConfig.class, "FeatureToggleConfig should be accessible");
        });
    }
}
