# frozen_string_literal: true
require_relative './connection_data'

module Hypertube
  module Utils
    class Http2ConnectionData < ConnectionData
      DEFAULT_CONNECT_TIMEOUT_SECONDS = 60

      attr_accessor :hostname, :timeout

      def initialize(hostname, timeout = DEFAULT_CONNECT_TIMEOUT_SECONDS)
        super()
        @hostname = hostname
        @timeout = timeout
      end

      def connection_type
        Hypertube::Utils::ConnectionType::HTTP2
      end

      def serialize_connection_data
        [connection_type, 0, 0, 0, 0, 0, 0]
      end

      def to_s
        "http2|#{@hostname}"
      end

      private

    end
  end
end
