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

// ShareThemeBackdropOption represents TL type `shareThemeBackdropOption#45c1d652`.
//
// See https://core.telegram.org/constructor/shareThemeBackdropOption for reference.
type ShareThemeBackdropOption struct {
	// BackdropID field of ShareThemeBackdropOption.
	BackdropID int
	// Name field of ShareThemeBackdropOption.
	Name string
	// CenterColor field of ShareThemeBackdropOption.
	CenterColor int
	// EdgeColor field of ShareThemeBackdropOption.
	EdgeColor int
	// PatternColor field of ShareThemeBackdropOption.
	PatternColor int
	// TextColor field of ShareThemeBackdropOption.
	TextColor int
}

// ShareThemeBackdropOptionTypeID is TL type id of ShareThemeBackdropOption.
const ShareThemeBackdropOptionTypeID = 0x45c1d652

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

func ( *ShareThemeBackdropOption) () bool {
	if  == nil {
		return true
	}
	if !(.BackdropID == 0) {
		return false
	}
	if !(.Name == "") {
		return false
	}
	if !(.CenterColor == 0) {
		return false
	}
	if !(.EdgeColor == 0) {
		return false
	}
	if !(.PatternColor == 0) {
		return false
	}
	if !(.TextColor == 0) {
		return false
	}

	return true
}

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

// FillFrom fills ShareThemeBackdropOption from given interface.
func ( *ShareThemeBackdropOption) ( interface {
	() ( int)
	() ( string)
	() ( int)
	() ( int)
	() ( int)
	() ( int)
}) {
	.BackdropID = .()
	.Name = .()
	.CenterColor = .()
	.EdgeColor = .()
	.PatternColor = .()
	.TextColor = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ShareThemeBackdropOption) () tdp.Type {
	 := tdp.Type{
		Name: "shareThemeBackdropOption",
		ID:   ShareThemeBackdropOptionTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "BackdropID",
			SchemaName: "backdrop_id",
		},
		{
			Name:       "Name",
			SchemaName: "name",
		},
		{
			Name:       "CenterColor",
			SchemaName: "center_color",
		},
		{
			Name:       "EdgeColor",
			SchemaName: "edge_color",
		},
		{
			Name:       "PatternColor",
			SchemaName: "pattern_color",
		},
		{
			Name:       "TextColor",
			SchemaName: "text_color",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ShareThemeBackdropOption) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode shareThemeBackdropOption#45c1d652 as nil")
	}
	.PutID(ShareThemeBackdropOptionTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ShareThemeBackdropOption) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode shareThemeBackdropOption#45c1d652 as nil")
	}
	.PutInt(.BackdropID)
	.PutString(.Name)
	.PutInt(.CenterColor)
	.PutInt(.EdgeColor)
	.PutInt(.PatternColor)
	.PutInt(.TextColor)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ShareThemeBackdropOption) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode shareThemeBackdropOption#45c1d652 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode shareThemeBackdropOption#45c1d652: field backdrop_id: %w", )
		}
		.BackdropID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode shareThemeBackdropOption#45c1d652: field name: %w", )
		}
		.Name = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode shareThemeBackdropOption#45c1d652: field center_color: %w", )
		}
		.CenterColor = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode shareThemeBackdropOption#45c1d652: field edge_color: %w", )
		}
		.EdgeColor = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode shareThemeBackdropOption#45c1d652: field pattern_color: %w", )
		}
		.PatternColor = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode shareThemeBackdropOption#45c1d652: field text_color: %w", )
		}
		.TextColor = 
	}
	return nil
}

// GetBackdropID returns value of BackdropID field.
func ( *ShareThemeBackdropOption) () ( int) {
	if  == nil {
		return
	}
	return .BackdropID
}

// GetName returns value of Name field.
func ( *ShareThemeBackdropOption) () ( string) {
	if  == nil {
		return
	}
	return .Name
}

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

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

// GetPatternColor returns value of PatternColor field.
func ( *ShareThemeBackdropOption) () ( int) {
	if  == nil {
		return
	}
	return .PatternColor
}

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