<?php

declare(strict_types=1);

namespace System\Http;

final class Response
{
    public function html(string $content): void
    {
        http_response_code(200);

        echo $content;
    }

    public function json(array $data): void
    {
        header('Content-Type: application/json');

        echo json_encode(
            $data,
            JSON_PRETTY_PRINT
        );
    }

    public function redirect(string $url): never
    {
        header("Location: {$url}");

        exit;
    }

    public function notFound(): never
    {
        http_response_code(404);

        exit('404 Not Found');
    }
}