<?php 
    if(isset($_GET['id']) && !empty($_GET['id'])) {
        $vimeoApi->deleteVideo($_GET['id']);
        $vimeoApi->deleteVideoFromDb($_GET['id']);
        $session->data['messageType'] = "success"; 
        $session->data['messageTitle'] = "Başarılı!"; 
        $session->data['message'] = "Video başarıyla silindi."; 

        if(isset($_GET['redirect']) && !empty($_GET['redirect'])) {
            header('Location: ' . $_GET['redirect']);
            exit();
        }else{
            header('Location: /admin/video-library/list');
            exit();
        }
    }else{
        $session->data['messageType'] = "error"; 
        $session->data['messageTitle'] = "Hata!"; 
        $session->data['message'] = "Bir hata oluştu ve video silinemedi."; 

        header('Location: /admin/video-library/list');
        exit();
    }