<?php

// ===========================================
// PDF Template Brand Color Tests
// ===========================================
// Verifies that all PDF templates use the new brand colors:
// - Charcoal: #4A4A42 (primary/header background)
// - Warm Gray: #C9C4BA (accent/borders)
// - Light Background: #E8E4DC
// - Deep Black: #1A1A1A (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 colors
    expect($template)->toContain('#4A4A42'); // Charcoal
    expect($template)->toContain('#C9C4BA'); // Warm Gray
    expect($template)->toContain('#E8E4DC'); // Light Background
    expect($template)->toContain('#1A1A1A'); // Deep Black text

    // Should NOT contain old colors
    expect($template)->not->toContain('#0A1F44'); // Old Navy
    expect($template)->not->toContain('#D4AF37'); // Old Gold
});

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 colors
    expect($template)->toContain('#4A4A42'); // Charcoal
    expect($template)->toContain('#C9C4BA'); // Warm Gray
    expect($template)->toContain('#E8E4DC'); // Light Background
    expect($template)->toContain('#1A1A1A'); // Deep Black text

    // Should NOT contain old colors
    expect($template)->not->toContain('#0A1F44'); // Old Navy
    expect($template)->not->toContain('#D4AF37'); // Old Gold
});

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 colors
    expect($template)->toContain('#4A4A42'); // Charcoal
    expect($template)->toContain('#C9C4BA'); // Warm Gray
    expect($template)->toContain('#E8E4DC'); // Light Background
    expect($template)->toContain('#1A1A1A'); // Deep Black text

    // Should NOT contain old colors
    expect($template)->not->toContain('#0A1F44'); // Old Navy
    expect($template)->not->toContain('#D4AF37'); // Old Gold
});

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 colors
    expect($template)->toContain('#4A4A42'); // Charcoal
    expect($template)->toContain('#C9C4BA'); // Warm Gray
    expect($template)->toContain('#E8E4DC'); // Light Background
    expect($template)->toContain('#1A1A1A'); // Deep Black text

    // Should NOT contain old colors
    expect($template)->not->toContain('#0A1F44'); // Old Navy
    expect($template)->not->toContain('#D4AF37'); // Old Gold
});

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

    // Should contain new colors for charts
    expect($service)->toContain('#4A4A42'); // Charcoal
    expect($service)->toContain('#C9C4BA'); // Warm Gray

    // Should NOT contain old colors
    expect($service)->not->toContain('#0A1F44'); // Old Navy
    expect($service)->not->toContain('#D4AF37'); // Old Gold
});

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 colors
    expect($template)->toContain('#4A4A42'); // Charcoal
    expect($template)->toContain('#C9C4BA'); // Warm Gray

    // Should NOT contain old colors
    expect($template)->not->toContain('#0A1F44'); // Old Navy
    expect($template)->not->toContain('#D4AF37'); // Old Gold
});
