<?php

namespace Tests\Feature\Settings;

use Tests\TestCase;

class AdminSettingsUiConfigurationTest extends TestCase
{
    public function test_confusing_duplicate_settings_are_hidden_or_removed(): void
    {
        $groups = config('settings.groups');

        $this->assertFalse($groups['job_sources']['visible_in_settings']);
        $this->assertArrayNotHasKey('unlock_price', $groups['pricing']['settings']);
        $this->assertArrayNotHasKey('currency', $groups['pricing']['settings']);
        $this->assertArrayNotHasKey('coupon_enabled', $groups['pricing']['settings']);
        $this->assertArrayNotHasKey('enable_maintenance_mode', $groups['security']['settings']);
        $this->assertArrayNotHasKey('enable_maintenance_mode', $groups['maintenance']['settings']);
    }

    public function test_file_upload_settings_do_not_use_string_validation_rules(): void
    {
        $groups = config('settings.groups');

        foreach (['branding.logo', 'branding.favicon', 'seo.og_image', 'seo.twitter_card_image'] as $setting) {
            [$group, $key] = explode('.', $setting);

            $this->assertSame('file', $groups[$group]['settings'][$key]['type']);
            $this->assertNotContains('string', $groups[$group]['settings'][$key]['rules'] ?? []);
        }
    }

    public function test_branding_logo_dimensions_are_configurable(): void
    {
        $branding = config('settings.groups.branding.settings');

        $this->assertSame('integer', $branding['logo_width_px']['type']);
        $this->assertSame('integer', $branding['logo_height_px']['type']);
        $this->assertContains('max:960', $branding['logo_width_px']['rules']);
        $this->assertContains('max:360', $branding['logo_height_px']['rules']);
    }
}
