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

package sctp

import (
	
	
)

/*
chunkCookieAck represents an SCTP Chunk of type chunkCookieAck

	 0                   1                   2                   3
	 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
	+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
	|   Type = 11   |Chunk  Flags   |     Length = 4                |
	+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
type chunkCookieAck struct {
	chunkHeader
}

// Cookie ack chunk errors.
var (
	ErrChunkTypeNotCookieAck = errors.New("ChunkType is not of type COOKIEACK")
)

func ( *chunkCookieAck) ( []byte) error {
	if  := .chunkHeader.unmarshal();  != nil {
		return 
	}

	if .typ != ctCookieAck {
		return fmt.Errorf("%w: actually is %s", ErrChunkTypeNotCookieAck, .typ.String())
	}

	return nil
}

func ( *chunkCookieAck) () ([]byte, error) {
	.chunkHeader.typ = ctCookieAck

	return .chunkHeader.marshal()
}

func ( *chunkCookieAck) () ( bool,  error) {
	return false, nil
}

// String makes chunkCookieAck printable.
func ( *chunkCookieAck) () string {
	return .chunkHeader.String()
}