<?php

namespace App\Events;

use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

/**
 * PRC-607 — Aktif session'da ziyaretçi mesajı geldiğinde admin'leri uyaran
 * İÇERİKSİZ sinyal. Mesaj içeriği ChatMessageSent ile chat.{id}'de kalır.
 */
class ChatSessionActivity implements ShouldBroadcastNow
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public function __construct(public int $sessionId) {}

    public function broadcastOn(): array
    {
        return [new PrivateChannel('admin.chat')];
    }

    public function broadcastAs(): string
    {
        return 'ChatSessionActivity';
    }

    public function broadcastWith(): array
    {
        return ['session_id' => $this->sessionId];
    }
}
