<?php
class DeeLauLab_AzuraCast_View {
    public function render( $template_name, $data = [] ) {
        $template_path = plugin_dir_path( dirname( __FILE__ ) ) . 'views/' . $template_name . '.php';
        if ( ! file_exists( $template_path ) ) {
            return '<div style="border: 2px solid red; padding: 15px; background-color: #ffe0e0;">' .
                   '<strong>PLUGIN-FEHLER:</strong> Die Template-Datei konnte nicht gefunden werden.<br>' .
                   '<strong>Erwarteter Pfad:</strong> ' . esc_html($template_path) .
                   '</div>';
        }
        extract( $data );
        ob_start();
        include $template_path;
        return ob_get_clean();
    }
    public function render_error( $message ) {
        return '<div class="dllah-error-message">' . esc_html( $message ) . '</div>';
    }
}