<?php

declare(strict_types=1);

namespace PHPMax\Protocol\Tcp;

use InvalidArgumentException;








final class MessagePackExtension
{
     
    private $type;

     
    private $data;

    public function __construct(int $type, string $data)
    {
        if ($type < -128 || $type > 127) {
            throw new InvalidArgumentException('MessagePack extension type must fit signed int8');
        }

        $this->type = $type;
        $this->data = $data;
    }

    public function type(): int
    {
        return $this->type;
    }

    public function data(): string
    {
        return $this->data;
    }
}
