<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class GroupUpdated implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    /**
     * Create a new event instance.
     */
    public function __construct()
    {
        // Kosongkan karena kita hanya butuh sinyal untuk mentrigger refresh
    }

    /**
     * Samakan channelnya dengan Guide dan Pendaki agar satu jalur.
     */
    public function broadcastOn(): array
    {
        return [
            new Channel('pendakian'),
        ];
    }

    /**
     * Nama sinyal yang akan dipanggil di JavaScript.
     */
    public function broadcastAs(): string
    {
        return 'group.updated';
    }
}