<?php

namespace Tests\Feature\Api;

use Tests\TestCase;

class PushNotificationTest extends TestCase
{
    public function test_push_badge_requires_auth(): void
    {
        $response = $this->getJson('/api/v1/push/badge');

        $response->assertUnauthorized();
    }

    public function test_push_track_requires_auth(): void
    {
        $response = $this->postJson('/api/v1/push/track', [
            'events' => [['event_type' => 'test', 'action' => 'opened']],
        ]);

        $response->assertUnauthorized();
    }

    public function test_push_heartbeat_requires_auth(): void
    {
        $response = $this->postJson('/api/v1/push/heartbeat', ['token' => 'abc']);

        $response->assertUnauthorized();
    }

    public function test_broadcast_send_requires_auth(): void
    {
        $response = $this->postJson('/api/v1/broadcast/send', []);

        $response->assertUnauthorized();
    }

    public function test_broadcast_history_requires_auth(): void
    {
        $response = $this->getJson('/api/v1/broadcast/history');

        $response->assertUnauthorized();
    }

    public function test_deeplinks_routes_requires_auth(): void
    {
        $response = $this->getJson('/api/v1/deeplinks/routes');

        $response->assertUnauthorized();
    }

    public function test_push_track_validates_events_array(): void
    {
        // Without auth it's 401, so we just verify the endpoint exists
        $response = $this->postJson('/api/v1/push/track', []);

        $this->assertContains($response->status(), [401, 422]);
    }
}
