<?php $__env->startSection('content'); ?>
<?php
    $authUser = auth()->user();
    $ownsLecture = $authUser?->hasRole('master-admin')
        || (int) ($lecture->created_by ?? 0) === (int) ($authUser->id ?? 0)
        || (int) ($lecture->course?->teacher_id ?? 0) === (int) ($authUser->id ?? 0);
    $canManage = $ownsLecture && $authUser?->can('lectures update');
?>

<div class="container-xxl flex-grow-1 container-p-y">
    <div class="card">
        <div class="card-header">
            <div class="d-flex justify-content-between align-items-center">
                <h5 class="mb-0"><?php echo e($lecture->title); ?></h5>
                <div>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($canManage): ?>
                        <a href="<?php echo e(route('lectures.edit', $lecture)); ?>" class="btn btn-warning">Edit</a>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <a href="<?php echo e(route('lectures.index')); ?>" class="btn btn-secondary">Back</a>
                </div>
            </div>
            <hr/>
        </div>

        <div class="card-body">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('success')): ?>
                <div class="alert alert-success"><?php echo e(session('success')); ?></div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

            <div class="row">
                <div class="col-lg-8 mb-4">
                    <div class="ratio ratio-16x9 rounded overflow-hidden bg-dark" oncontextmenu="return false;">
                        <video controls controlsList="nodownload" disablepictureinpicture playsinline preload="metadata" oncontextmenu="return false;" class="w-100 h-100">
                            <source src="<?php echo e(route('lectures.stream', $lecture)); ?>" type="<?php echo e($lecture->video_mime_type ?: 'video/mp4'); ?>">
                            Your browser does not support the video tag.
                        </video>
                    </div>
                    <small class="text-muted d-block mt-2">Playback only mode enabled. Direct download link is not shown to students.</small>
                </div>

                <div class="col-lg-4">
                    <div class="border rounded p-3 h-100">
                        <p><strong>Course:</strong> <?php echo e($lecture->course?->title ?? 'N/A'); ?></p>
                        <p><strong>Teacher:</strong> <?php echo e($lecture->course?->teacher?->name ?? 'N/A'); ?></p>
                        <p><strong>Uploaded By:</strong> <?php echo e($lecture->creator?->name ?? 'N/A'); ?></p>
                        <p><strong>Uploaded At:</strong> <?php echo e($lecture->created_at?->format('Y-m-d H:i')); ?></p>
                        <p><strong>Video Size:</strong> <?php echo e($lecture->video_size ? number_format($lecture->video_size / 1048576, 2) . ' MB' : 'N/A'); ?></p>
                        <p><strong>Description:</strong></p>
                        <p class="mb-0"><?php echo e($lecture->description ?: 'No description added.'); ?></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\xampp\htdocs\digitizing-academy.lifelinehealthcare.com.pk\resources\views\lectures\show.blade.php ENDPATH**/ ?>