<?php

// ===========================================
// PDF Template Brand Color Tests
// ===========================================
// Verifies that all PDF templates use the new brand colors:
// - Dark Forest Green: #2D3624 (primary/header background)
// - Warm Gold: #A68966 (accent/highlight)
// - Gold Light: #C4A882 (borders/accents)
// - Warm Cream: #F4F1EA (backgrounds)
// - Forest Green: #2D322A (text)

test('users-export PDF template uses new brand colors', function () {
    $template = file_get_contents(resource_path('views/pdf/users-export.blade.php'));

    // Should contain new Dark Forest Green and Warm Gold colors
    expect($template)->toContain('#2D3624'); // Dark Forest Green
    expect($template)->toContain('#A68966'); // Warm Gold
    expect($template)->toContain('#C4A882'); // Gold Light
    expect($template)->toContain('#F4F1EA'); // Warm Cream
    expect($template)->toContain('#2D322A'); // Forest Green text

    // Should NOT contain old colors
    expect($template)->not->toContain('#8AB357'); // Old Olive Green
    expect($template)->not->toContain('#A5C87A'); // Old Light Olive
    expect($template)->not->toContain('#E8E4DC'); // Old Light Background
    expect($template)->not->toContain('#1A1A1A'); // Old Deep Black
});

test('consultations-export PDF template uses new brand colors', function () {
    $template = file_get_contents(resource_path('views/pdf/consultations-export.blade.php'));

    // Should contain new Dark Forest Green and Warm Gold colors
    expect($template)->toContain('#2D3624'); // Dark Forest Green
    expect($template)->toContain('#A68966'); // Warm Gold
    expect($template)->toContain('#C4A882'); // Gold Light
    expect($template)->toContain('#F4F1EA'); // Warm Cream
    expect($template)->toContain('#2D322A'); // Forest Green text

    // Should NOT contain old colors
    expect($template)->not->toContain('#8AB357'); // Old Olive Green
    expect($template)->not->toContain('#A5C87A'); // Old Light Olive
    expect($template)->not->toContain('#E8E4DC'); // Old Light Background
    expect($template)->not->toContain('#1A1A1A'); // Old Deep Black
});

test('timelines-export PDF template uses new brand colors', function () {
    $template = file_get_contents(resource_path('views/pdf/timelines-export.blade.php'));

    // Should contain new Dark Forest Green and Warm Gold colors
    expect($template)->toContain('#2D3624'); // Dark Forest Green
    expect($template)->toContain('#A68966'); // Warm Gold
    expect($template)->toContain('#C4A882'); // Gold Light
    expect($template)->toContain('#F4F1EA'); // Warm Cream
    expect($template)->toContain('#2D322A'); // Forest Green text

    // Should NOT contain old colors
    expect($template)->not->toContain('#8AB357'); // Old Olive Green
    expect($template)->not->toContain('#A5C87A'); // Old Light Olive
    expect($template)->not->toContain('#E8E4DC'); // Old Light Background
    expect($template)->not->toContain('#1A1A1A'); // Old Deep Black
});

test('monthly-report PDF template uses new brand colors', function () {
    $template = file_get_contents(resource_path('views/pdf/monthly-report.blade.php'));

    // Should contain new Dark Forest Green and Warm Gold colors
    expect($template)->toContain('#2D3624'); // Dark Forest Green
    expect($template)->toContain('#A68966'); // Warm Gold
    expect($template)->toContain('#C4A882'); // Gold Light
    expect($template)->toContain('#F4F1EA'); // Warm Cream
    expect($template)->toContain('#2D322A'); // Forest Green text

    // Should NOT contain old colors
    expect($template)->not->toContain('#8AB357'); // Old Olive Green
    expect($template)->not->toContain('#A5C87A'); // Old Light Olive
    expect($template)->not->toContain('#E8E4DC'); // Old Light Background
    expect($template)->not->toContain('#1A1A1A'); // Old Deep Black
});

test('MonthlyReportService uses new brand colors for charts', function () {
    $service = file_get_contents(app_path('Services/MonthlyReportService.php'));

    // Should contain new Warm Gold colors for charts
    expect($service)->toContain('#A68966'); // Warm Gold
    expect($service)->toContain('#C4A882'); // Gold Light

    // Should NOT contain old colors
    expect($service)->not->toContain('#8AB357'); // Old Olive Green
    expect($service)->not->toContain('#A5C87A'); // Old Light Olive
});

test('monthly-report Livewire component uses new brand colors', function () {
    $template = file_get_contents(resource_path('views/livewire/admin/reports/monthly-report.blade.php'));

    // Should contain new Dark Forest Green and Warm Gold colors
    expect($template)->toContain('#2D3624'); // Dark Forest Green
    expect($template)->toContain('#A68966'); // Warm Gold

    // Should NOT contain old colors
    expect($template)->not->toContain('#8AB357'); // Old Olive Green
    expect($template)->not->toContain('#A5C87A'); // Old Light Olive
});
