// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT

package sctp

import (
	
	
)

type param interface {
	marshal() ([]byte, error)
	length() int
}

// ErrParamTypeUnhandled is returned if unknown parameter type is specified.
var ErrParamTypeUnhandled = errors.New("unhandled ParamType")

func buildParam( paramType,  []byte) (param, error) { //nolint:cyclop
	switch  {
	case forwardTSNSupp:
		return (&paramForwardTSNSupported{}).unmarshal()
	case supportedExt:
		return (&paramSupportedExtensions{}).unmarshal()
	case ecnCapable:
		return (&paramECNCapable{}).unmarshal()
	case random:
		return (&paramRandom{}).unmarshal()
	case reqHMACAlgo:
		return (&paramRequestedHMACAlgorithm{}).unmarshal()
	case chunkList:
		return (&paramChunkList{}).unmarshal()
	case stateCookie:
		return (&paramStateCookie{}).unmarshal()
	case heartbeatInfo:
		return (&paramHeartbeatInfo{}).unmarshal()
	case outSSNResetReq:
		return (&paramOutgoingResetRequest{}).unmarshal()
	case reconfigResp:
		return (&paramReconfigResponse{}).unmarshal()
	case zeroChecksumAcceptable:
		return (&paramZeroChecksumAcceptable{}).unmarshal()
	default:
		return nil, fmt.Errorf("%w: %v", ErrParamTypeUnhandled, )
	}
}