<?php

// ===========================================
// PDF Template Brand Color Tests
// ===========================================
// Verifies that all PDF templates use the new brand colors:
// - Olive Green: #8AB357 (primary/header background)
// - Light Olive: #A5C87A (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 olive green colors
    expect($template)->toContain('#8AB357'); // Olive Green
    expect($template)->toContain('#A5C87A'); // Light Olive
    expect($template)->toContain('#E8E4DC'); // Light Background
    expect($template)->toContain('#1A1A1A'); // Deep Black text

    // Should NOT contain old colors
    expect($template)->not->toContain('#4A4A42'); // Old Charcoal
    expect($template)->not->toContain('#C9C4BA'); // Old Warm Gray
});

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 olive green colors
    expect($template)->toContain('#8AB357'); // Olive Green
    expect($template)->toContain('#A5C87A'); // Light Olive
    expect($template)->toContain('#E8E4DC'); // Light Background
    expect($template)->toContain('#1A1A1A'); // Deep Black text

    // Should NOT contain old colors
    expect($template)->not->toContain('#4A4A42'); // Old Charcoal
    expect($template)->not->toContain('#C9C4BA'); // Old Warm Gray
});

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 olive green colors
    expect($template)->toContain('#8AB357'); // Olive Green
    expect($template)->toContain('#A5C87A'); // Light Olive
    expect($template)->toContain('#E8E4DC'); // Light Background
    expect($template)->toContain('#1A1A1A'); // Deep Black text

    // Should NOT contain old colors
    expect($template)->not->toContain('#4A4A42'); // Old Charcoal
    expect($template)->not->toContain('#C9C4BA'); // Old Warm Gray
});

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 olive green colors
    expect($template)->toContain('#8AB357'); // Olive Green
    expect($template)->toContain('#A5C87A'); // Light Olive
    expect($template)->toContain('#E8E4DC'); // Light Background
    expect($template)->toContain('#1A1A1A'); // Deep Black text

    // Should NOT contain old colors
    expect($template)->not->toContain('#4A4A42'); // Old Charcoal
    expect($template)->not->toContain('#C9C4BA'); // Old Warm Gray
});

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

    // Should contain new olive green colors for charts
    expect($service)->toContain('#8AB357'); // Olive Green
    expect($service)->toContain('#A5C87A'); // Light Olive

    // Should NOT contain old colors
    expect($service)->not->toContain('#4A4A42'); // Old Charcoal
    expect($service)->not->toContain('#C9C4BA'); // Old Warm Gray
});

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 olive green colors
    expect($template)->toContain('#8AB357'); // Olive Green
    expect($template)->toContain('#A5C87A'); // Light Olive

    // Should NOT contain old colors
    expect($template)->not->toContain('#4A4A42'); // Old Charcoal
    expect($template)->not->toContain('#C9C4BA'); // Old Warm Gray
});
