<?php
declare(strict_types=1);

namespace FreshCloud\Mail\NetSocket;

final readonly class SocketConfig
{
    public function __construct(
        public string $host,
        public int $port,
        public int $timeoutSeconds = 30,
        public bool $sslEnabled = false,
    ) {
        $this->validatePort();
    }

    private function validatePort(): void
    {
        if ($this->port < 1 || $this->port > 65535) {
            throw new \InvalidArgumentException("Port must be between 1 and 65535");
        }
    }
}