// Code generated by gotdgen, DO NOT EDIT.

package tg

import (
	
	
	
	
	

	

	
	
	
	
)

// No-op definition for keeping imports.
var (
	_ = bin.Buffer{}
	_ = context.Background()
	_ = fmt.Stringer(nil)
	_ = strings.Builder{}
	_ = errors.Is
	_ = multierr.AppendInto
	_ = sort.Ints
	_ = tdp.Format
	_ = tgerr.Error{}
	_ = tdjson.Encoder{}
)

// PeerColor represents TL type `peerColor#b54b5acf`.
// Represents a color palette »¹.
//
// Links:
//  1. https://core.telegram.org/api/colors
//
// See https://core.telegram.org/constructor/peerColor for reference.
type PeerColor struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Color palette ID, see here »¹ for more info; if not set, the default palette should
	// be used.
	//
	// Links:
	//  1) https://core.telegram.org/api/colors
	//
	// Use SetColor and GetColor helpers.
	Color int
	// Optional custom emoji ID¹ used to generate the pattern.
	//
	// Links:
	//  1) https://core.telegram.org/api/custom-emoji
	//
	// Use SetBackgroundEmojiID and GetBackgroundEmojiID helpers.
	BackgroundEmojiID int64
}

// PeerColorTypeID is TL type id of PeerColor.
const PeerColorTypeID = 0xb54b5acf

// construct implements constructor of PeerColorClass.
func ( PeerColor) () PeerColorClass { return & }

// Ensuring interfaces in compile-time for PeerColor.
var (
	_ bin.Encoder     = &PeerColor{}
	_ bin.Decoder     = &PeerColor{}
	_ bin.BareEncoder = &PeerColor{}
	_ bin.BareDecoder = &PeerColor{}

	_ PeerColorClass = &PeerColor{}
)

func ( *PeerColor) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Color == 0) {
		return false
	}
	if !(.BackgroundEmojiID == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *PeerColor) () string {
	if  == nil {
		return "PeerColor(nil)"
	}
	type  PeerColor
	return fmt.Sprintf("PeerColor%+v", (*))
}

// FillFrom fills PeerColor from given interface.
func ( *PeerColor) ( interface {
	() ( int,  bool)
	() ( int64,  bool)
}) {
	if ,  := .();  {
		.Color = 
	}

	if ,  := .();  {
		.BackgroundEmojiID = 
	}

}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PeerColor) () uint32 {
	return PeerColorTypeID
}

// TypeName returns name of type in TL schema.
func (*PeerColor) () string {
	return "peerColor"
}

// TypeInfo returns info about TL type.
func ( *PeerColor) () tdp.Type {
	 := tdp.Type{
		Name: "peerColor",
		ID:   PeerColorTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Color",
			SchemaName: "color",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "BackgroundEmojiID",
			SchemaName: "background_emoji_id",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *PeerColor) () {
	if !(.Color == 0) {
		.Flags.Set(0)
	}
	if !(.BackgroundEmojiID == 0) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *PeerColor) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode peerColor#b54b5acf as nil")
	}
	.PutID(PeerColorTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PeerColor) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode peerColor#b54b5acf as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode peerColor#b54b5acf: field flags: %w", )
	}
	if .Flags.Has(0) {
		.PutInt(.Color)
	}
	if .Flags.Has(1) {
		.PutLong(.BackgroundEmojiID)
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *PeerColor) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode peerColor#b54b5acf to nil")
	}
	if  := .ConsumeID(PeerColorTypeID);  != nil {
		return fmt.Errorf("unable to decode peerColor#b54b5acf: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *PeerColor) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode peerColor#b54b5acf to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode peerColor#b54b5acf: field flags: %w", )
		}
	}
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode peerColor#b54b5acf: field color: %w", )
		}
		.Color = 
	}
	if .Flags.Has(1) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode peerColor#b54b5acf: field background_emoji_id: %w", )
		}
		.BackgroundEmojiID = 
	}
	return nil
}

// SetColor sets value of Color conditional field.
func ( *PeerColor) ( int) {
	.Flags.Set(0)
	.Color = 
}

// GetColor returns value of Color conditional field and
// boolean which is true if field was set.
func ( *PeerColor) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Color, true
}

// SetBackgroundEmojiID sets value of BackgroundEmojiID conditional field.
func ( *PeerColor) ( int64) {
	.Flags.Set(1)
	.BackgroundEmojiID = 
}

// GetBackgroundEmojiID returns value of BackgroundEmojiID conditional field and
// boolean which is true if field was set.
func ( *PeerColor) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .BackgroundEmojiID, true
}

// PeerColorCollectible represents TL type `peerColorCollectible#b9c0639a`.
// Represents a color palette »¹ associated to a collectible gift »², see here »³
// for more info.
//
// Links:
//  1. https://core.telegram.org/api/colors
//  2. https://core.telegram.org/api/gifts#collectible-gifts
//  3. https://core.telegram.org/api/colors#collectible-gift-palettes
//
// See https://core.telegram.org/constructor/peerColorCollectible for reference.
type PeerColorCollectible struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// ID of the collectible gift »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#collectible-gifts
	CollectibleID int64
	// Custom emoji ID »¹ of the collectible gift: a single copy of this custom emoji
	// should be displayed as-is (without recoloring it, unlike for background_emoji_id) in
	// the top-right corner of the palette.
	//
	// Links:
	//  1) https://core.telegram.org/api/custom-emoji
	GiftEmojiID int64
	// Custom emoji ID »¹ used to generate the pattern.
	//
	// Links:
	//  1) https://core.telegram.org/api/custom-emoji
	BackgroundEmojiID int64
	// Accent color in RGB24 format, used for reply backgrounds and the user's name in
	// messages.
	AccentColor int
	// 1-3 RGB24 colors to be used in the reply strip.
	Colors []int
	// Accent color in RGB24 format, used for reply backgrounds and the user's name in
	// messages in dark mode (fallback to accent_color if absent).
	//
	// Use SetDarkAccentColor and GetDarkAccentColor helpers.
	DarkAccentColor int
	// 1-3 RGB24 colors to be used in the reply strip in dark mode (fallback to colors if
	// absent).
	//
	// Use SetDarkColors and GetDarkColors helpers.
	DarkColors []int
}

// PeerColorCollectibleTypeID is TL type id of PeerColorCollectible.
const PeerColorCollectibleTypeID = 0xb9c0639a

// construct implements constructor of PeerColorClass.
func ( PeerColorCollectible) () PeerColorClass { return & }

// Ensuring interfaces in compile-time for PeerColorCollectible.
var (
	_ bin.Encoder     = &PeerColorCollectible{}
	_ bin.Decoder     = &PeerColorCollectible{}
	_ bin.BareEncoder = &PeerColorCollectible{}
	_ bin.BareDecoder = &PeerColorCollectible{}

	_ PeerColorClass = &PeerColorCollectible{}
)

func ( *PeerColorCollectible) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.CollectibleID == 0) {
		return false
	}
	if !(.GiftEmojiID == 0) {
		return false
	}
	if !(.BackgroundEmojiID == 0) {
		return false
	}
	if !(.AccentColor == 0) {
		return false
	}
	if !(.Colors == nil) {
		return false
	}
	if !(.DarkAccentColor == 0) {
		return false
	}
	if !(.DarkColors == nil) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *PeerColorCollectible) () string {
	if  == nil {
		return "PeerColorCollectible(nil)"
	}
	type  PeerColorCollectible
	return fmt.Sprintf("PeerColorCollectible%+v", (*))
}

// FillFrom fills PeerColorCollectible from given interface.
func ( *PeerColorCollectible) ( interface {
	() ( int64)
	() ( int64)
	() ( int64)
	() ( int)
	() ( []int)
	() ( int,  bool)
	() ( []int,  bool)
}) {
	.CollectibleID = .()
	.GiftEmojiID = .()
	.BackgroundEmojiID = .()
	.AccentColor = .()
	.Colors = .()
	if ,  := .();  {
		.DarkAccentColor = 
	}

	if ,  := .();  {
		.DarkColors = 
	}

}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*PeerColorCollectible) () uint32 {
	return PeerColorCollectibleTypeID
}

// TypeName returns name of type in TL schema.
func (*PeerColorCollectible) () string {
	return "peerColorCollectible"
}

// TypeInfo returns info about TL type.
func ( *PeerColorCollectible) () tdp.Type {
	 := tdp.Type{
		Name: "peerColorCollectible",
		ID:   PeerColorCollectibleTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "CollectibleID",
			SchemaName: "collectible_id",
		},
		{
			Name:       "GiftEmojiID",
			SchemaName: "gift_emoji_id",
		},
		{
			Name:       "BackgroundEmojiID",
			SchemaName: "background_emoji_id",
		},
		{
			Name:       "AccentColor",
			SchemaName: "accent_color",
		},
		{
			Name:       "Colors",
			SchemaName: "colors",
		},
		{
			Name:       "DarkAccentColor",
			SchemaName: "dark_accent_color",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "DarkColors",
			SchemaName: "dark_colors",
			Null:       !.Flags.Has(1),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *PeerColorCollectible) () {
	if !(.DarkAccentColor == 0) {
		.Flags.Set(0)
	}
	if !(.DarkColors == nil) {
		.Flags.Set(1)
	}
}

// Encode implements bin.Encoder.
func ( *PeerColorCollectible) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode peerColorCollectible#b9c0639a as nil")
	}
	.PutID(PeerColorCollectibleTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PeerColorCollectible) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode peerColorCollectible#b9c0639a as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode peerColorCollectible#b9c0639a: field flags: %w", )
	}
	.PutLong(.CollectibleID)
	.PutLong(.GiftEmojiID)
	.PutLong(.BackgroundEmojiID)
	.PutInt(.AccentColor)
	.PutVectorHeader(len(.Colors))
	for ,  := range .Colors {
		.PutInt()
	}
	if .Flags.Has(0) {
		.PutInt(.DarkAccentColor)
	}
	if .Flags.Has(1) {
		.PutVectorHeader(len(.DarkColors))
		for ,  := range .DarkColors {
			.PutInt()
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *PeerColorCollectible) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode peerColorCollectible#b9c0639a to nil")
	}
	if  := .ConsumeID(PeerColorCollectibleTypeID);  != nil {
		return fmt.Errorf("unable to decode peerColorCollectible#b9c0639a: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *PeerColorCollectible) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode peerColorCollectible#b9c0639a to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode peerColorCollectible#b9c0639a: field flags: %w", )
		}
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode peerColorCollectible#b9c0639a: field collectible_id: %w", )
		}
		.CollectibleID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode peerColorCollectible#b9c0639a: field gift_emoji_id: %w", )
		}
		.GiftEmojiID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode peerColorCollectible#b9c0639a: field background_emoji_id: %w", )
		}
		.BackgroundEmojiID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode peerColorCollectible#b9c0639a: field accent_color: %w", )
		}
		.AccentColor = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode peerColorCollectible#b9c0639a: field colors: %w", )
		}

		if  > 0 {
			.Colors = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode peerColorCollectible#b9c0639a: field colors: %w", )
			}
			.Colors = append(.Colors, )
		}
	}
	if .Flags.Has(0) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode peerColorCollectible#b9c0639a: field dark_accent_color: %w", )
		}
		.DarkAccentColor = 
	}
	if .Flags.Has(1) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode peerColorCollectible#b9c0639a: field dark_colors: %w", )
		}

		if  > 0 {
			.DarkColors = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode peerColorCollectible#b9c0639a: field dark_colors: %w", )
			}
			.DarkColors = append(.DarkColors, )
		}
	}
	return nil
}

// GetCollectibleID returns value of CollectibleID field.
func ( *PeerColorCollectible) () ( int64) {
	if  == nil {
		return
	}
	return .CollectibleID
}

// GetGiftEmojiID returns value of GiftEmojiID field.
func ( *PeerColorCollectible) () ( int64) {
	if  == nil {
		return
	}
	return .GiftEmojiID
}

// GetBackgroundEmojiID returns value of BackgroundEmojiID field.
func ( *PeerColorCollectible) () ( int64) {
	if  == nil {
		return
	}
	return .BackgroundEmojiID
}

// GetAccentColor returns value of AccentColor field.
func ( *PeerColorCollectible) () ( int) {
	if  == nil {
		return
	}
	return .AccentColor
}

// GetColors returns value of Colors field.
func ( *PeerColorCollectible) () ( []int) {
	if  == nil {
		return
	}
	return .Colors
}

// SetDarkAccentColor sets value of DarkAccentColor conditional field.
func ( *PeerColorCollectible) ( int) {
	.Flags.Set(0)
	.DarkAccentColor = 
}

// GetDarkAccentColor returns value of DarkAccentColor conditional field and
// boolean which is true if field was set.
func ( *PeerColorCollectible) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .DarkAccentColor, true
}

// SetDarkColors sets value of DarkColors conditional field.
func ( *PeerColorCollectible) ( []int) {
	.Flags.Set(1)
	.DarkColors = 
}

// GetDarkColors returns value of DarkColors conditional field and
// boolean which is true if field was set.
func ( *PeerColorCollectible) () ( []int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .DarkColors, true
}

// InputPeerColorCollectible represents TL type `inputPeerColorCollectible#b8ea86a9`.
// Represents a color palette »¹ associated to a collectible gift »², see here »³
// for more info.
//
// Links:
//  1. https://core.telegram.org/api/colors
//  2. https://core.telegram.org/api/gifts#collectible-gifts
//  3. https://core.telegram.org/api/colors#collectible-gift-palettes
//
// See https://core.telegram.org/constructor/inputPeerColorCollectible for reference.
type InputPeerColorCollectible struct {
	// ID of the collectible gift »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#collectible-gifts
	CollectibleID int64
}

// InputPeerColorCollectibleTypeID is TL type id of InputPeerColorCollectible.
const InputPeerColorCollectibleTypeID = 0xb8ea86a9

// construct implements constructor of PeerColorClass.
func ( InputPeerColorCollectible) () PeerColorClass { return & }

// Ensuring interfaces in compile-time for InputPeerColorCollectible.
var (
	_ bin.Encoder     = &InputPeerColorCollectible{}
	_ bin.Decoder     = &InputPeerColorCollectible{}
	_ bin.BareEncoder = &InputPeerColorCollectible{}
	_ bin.BareDecoder = &InputPeerColorCollectible{}

	_ PeerColorClass = &InputPeerColorCollectible{}
)

func ( *InputPeerColorCollectible) () bool {
	if  == nil {
		return true
	}
	if !(.CollectibleID == 0) {
		return false
	}

	return true
}

// String implements fmt.Stringer.
func ( *InputPeerColorCollectible) () string {
	if  == nil {
		return "InputPeerColorCollectible(nil)"
	}
	type  InputPeerColorCollectible
	return fmt.Sprintf("InputPeerColorCollectible%+v", (*))
}

// FillFrom fills InputPeerColorCollectible from given interface.
func ( *InputPeerColorCollectible) ( interface {
	() ( int64)
}) {
	.CollectibleID = .()
}

// TypeID returns type id in TL schema.
//
// See https://core.telegram.org/mtproto/TL-tl#remarks.
func (*InputPeerColorCollectible) () uint32 {
	return InputPeerColorCollectibleTypeID
}

// TypeName returns name of type in TL schema.
func (*InputPeerColorCollectible) () string {
	return "inputPeerColorCollectible"
}

// TypeInfo returns info about TL type.
func ( *InputPeerColorCollectible) () tdp.Type {
	 := tdp.Type{
		Name: "inputPeerColorCollectible",
		ID:   InputPeerColorCollectibleTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "CollectibleID",
			SchemaName: "collectible_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPeerColorCollectible) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPeerColorCollectible#b8ea86a9 as nil")
	}
	.PutID(InputPeerColorCollectibleTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPeerColorCollectible) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPeerColorCollectible#b8ea86a9 as nil")
	}
	.PutLong(.CollectibleID)
	return nil
}

// Decode implements bin.Decoder.
func ( *InputPeerColorCollectible) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPeerColorCollectible#b8ea86a9 to nil")
	}
	if  := .ConsumeID(InputPeerColorCollectibleTypeID);  != nil {
		return fmt.Errorf("unable to decode inputPeerColorCollectible#b8ea86a9: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *InputPeerColorCollectible) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPeerColorCollectible#b8ea86a9 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputPeerColorCollectible#b8ea86a9: field collectible_id: %w", )
		}
		.CollectibleID = 
	}
	return nil
}

// GetCollectibleID returns value of CollectibleID field.
func ( *InputPeerColorCollectible) () ( int64) {
	if  == nil {
		return
	}
	return .CollectibleID
}

// PeerColorClassName is schema name of PeerColorClass.
const PeerColorClassName = "PeerColor"

// PeerColorClass represents PeerColor generic type.
//
// See https://core.telegram.org/type/PeerColor for reference.
//
// Constructors:
//   - [PeerColor]
//   - [PeerColorCollectible]
//   - [InputPeerColorCollectible]
//
// Example:
//
//	g, err := tg.DecodePeerColor(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.PeerColor: // peerColor#b54b5acf
//	case *tg.PeerColorCollectible: // peerColorCollectible#b9c0639a
//	case *tg.InputPeerColorCollectible: // inputPeerColorCollectible#b8ea86a9
//	default: panic(v)
//	}
type PeerColorClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() PeerColorClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool
}

// DecodePeerColor implements binary de-serialization for PeerColorClass.
func ( *bin.Buffer) (PeerColorClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case PeerColorTypeID:
		// Decoding peerColor#b54b5acf.
		 := PeerColor{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PeerColorClass: %w", )
		}
		return &, nil
	case PeerColorCollectibleTypeID:
		// Decoding peerColorCollectible#b9c0639a.
		 := PeerColorCollectible{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PeerColorClass: %w", )
		}
		return &, nil
	case InputPeerColorCollectibleTypeID:
		// Decoding inputPeerColorCollectible#b8ea86a9.
		 := InputPeerColorCollectible{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PeerColorClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode PeerColorClass: %w", bin.NewUnexpectedID())
	}
}

// PeerColor boxes the PeerColorClass providing a helper.
type PeerColorBox struct {
	PeerColor PeerColorClass
}

// Decode implements bin.Decoder for PeerColorBox.
func ( *PeerColorBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode PeerColorBox to nil")
	}
	,  := DecodePeerColor()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.PeerColor = 
	return nil
}

// Encode implements bin.Encode for PeerColorBox.
func ( *PeerColorBox) ( *bin.Buffer) error {
	if  == nil || .PeerColor == nil {
		return fmt.Errorf("unable to encode PeerColorClass as nil")
	}
	return .PeerColor.Encode()
}