<?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 PengumumanCreated implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public function __construct(
        public int $idPengumuman,
        public string $judul,
        public string $ringkasan,
    ) {}

    public function broadcastOn(): array
    {
        return [new Channel('pengumuman')];
    }

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