<?php

declare(strict_types=1);

namespace App\Framework\Http\Cookies;

final readonly class Cookies
{
    /** @var array<string, Cookie> */
    private array $cookies;

    public function __construct(Cookie ...$cookies)
    {
        foreach ($cookies as $cookie) {
            $cookies[$cookie->name] = $cookie;
        }
        $this->cookies = $cookies;
    }

    public function get(string $name): ?Cookie
    {
        return $this->cookies[$name] ?? null;
    }
}
