<?php
namespace App\Models;

use App\Core\Model;

class BroadcastLog extends Model {
    protected static string $table = 'broadcast_logs';

    public static function getByBroadcast(int $broadcastId): array {
        $stmt = self::db()->prepare("
            SELECT bl.*, c.name as contact_name
            FROM broadcast_logs bl
            LEFT JOIN contacts c ON bl.contact_id = c.id
            WHERE bl.broadcast_id = ?
            ORDER BY bl.created_at DESC
        ");
        $stmt->execute([$broadcastId]);
        return $stmt->fetchAll();
    }
}
