<?php

namespace Licenzo\Hooks\Handler;

// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}

use Licenzo\Framework\Http\Request;
use Licenzo\Framework\Http\Response;

/**
 * Terminate Handler
 *
 * Custom cleanup logic executed after all middleware->terminate() methods.
 * Use this for application-level cleanup tasks.
 */
class Terminate
{
    /**
     * Execute termination cleanup
     *
     * Called from Application::terminate() after all middleware termination.
     * Add custom cleanup logic here:
     * - Flush caches
     * - Log analytics
     * - Send metrics
     * - Clean up temporary files
     * - etc.
     *
     * @param Request $request
     * @param Response|mixed $response
     * @return void
     */
    public function terminate(Request $request, $response)
    {
        // Custom cleanup logic here
        // Example: flush caches, log analytics, send metrics, etc.

        // This is called AFTER all middleware->terminate() methods
        // Use this for application-level cleanup tasks
    }
}
