// 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{}
)

// StarGiftBackground represents TL type `starGiftBackground#aff56398`.
// Contains the default background palette of a gift type »¹.
//
// Links:
//  1. https://core.telegram.org/api/gifts#listing-all-possible-collectible-variants
//
// See https://core.telegram.org/constructor/starGiftBackground for reference.
type StarGiftBackground struct {
	// Center color of the background palette, in RGB24 format.
	CenterColor int
	// Edge color of the background palette, in RGB24 format.
	EdgeColor int
	// Text color to use on top of the background palette, in RGB24 format.
	TextColor int
}

// StarGiftBackgroundTypeID is TL type id of StarGiftBackground.
const StarGiftBackgroundTypeID = 0xaff56398

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

func ( *StarGiftBackground) () bool {
	if  == nil {
		return true
	}
	if !(.CenterColor == 0) {
		return false
	}
	if !(.EdgeColor == 0) {
		return false
	}
	if !(.TextColor == 0) {
		return false
	}

	return true
}

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

// FillFrom fills StarGiftBackground from given interface.
func ( *StarGiftBackground) ( interface {
	() ( int)
	() ( int)
	() ( int)
}) {
	.CenterColor = .()
	.EdgeColor = .()
	.TextColor = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *StarGiftBackground) () tdp.Type {
	 := tdp.Type{
		Name: "starGiftBackground",
		ID:   StarGiftBackgroundTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "CenterColor",
			SchemaName: "center_color",
		},
		{
			Name:       "EdgeColor",
			SchemaName: "edge_color",
		},
		{
			Name:       "TextColor",
			SchemaName: "text_color",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *StarGiftBackground) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode starGiftBackground#aff56398 as nil")
	}
	.PutID(StarGiftBackgroundTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StarGiftBackground) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode starGiftBackground#aff56398 as nil")
	}
	.PutInt(.CenterColor)
	.PutInt(.EdgeColor)
	.PutInt(.TextColor)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StarGiftBackground) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode starGiftBackground#aff56398 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode starGiftBackground#aff56398: field center_color: %w", )
		}
		.CenterColor = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode starGiftBackground#aff56398: field edge_color: %w", )
		}
		.EdgeColor = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode starGiftBackground#aff56398: field text_color: %w", )
		}
		.TextColor = 
	}
	return nil
}

// GetCenterColor returns value of CenterColor field.
func ( *StarGiftBackground) () ( int) {
	if  == nil {
		return
	}
	return .CenterColor
}

// GetEdgeColor returns value of EdgeColor field.
func ( *StarGiftBackground) () ( int) {
	if  == nil {
		return
	}
	return .EdgeColor
}

// GetTextColor returns value of TextColor field.
func ( *StarGiftBackground) () ( int) {
	if  == nil {
		return
	}
	return .TextColor
}