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

// InputStickeredMediaPhoto represents TL type `inputStickeredMediaPhoto#4a992157`.
// A photo with stickers attached
//
// See https://core.telegram.org/constructor/inputStickeredMediaPhoto for reference.
type InputStickeredMediaPhoto struct {
	// The photo
	ID InputPhotoClass
}

// InputStickeredMediaPhotoTypeID is TL type id of InputStickeredMediaPhoto.
const InputStickeredMediaPhotoTypeID = 0x4a992157

// construct implements constructor of InputStickeredMediaClass.
func ( InputStickeredMediaPhoto) () InputStickeredMediaClass { return & }

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

	_ InputStickeredMediaClass = &InputStickeredMediaPhoto{}
)

func ( *InputStickeredMediaPhoto) () bool {
	if  == nil {
		return true
	}
	if !(.ID == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputStickeredMediaPhoto from given interface.
func ( *InputStickeredMediaPhoto) ( interface {
	() ( InputPhotoClass)
}) {
	.ID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputStickeredMediaPhoto) () tdp.Type {
	 := tdp.Type{
		Name: "inputStickeredMediaPhoto",
		ID:   InputStickeredMediaPhotoTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputStickeredMediaPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputStickeredMediaPhoto#4a992157 as nil")
	}
	.PutID(InputStickeredMediaPhotoTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputStickeredMediaPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputStickeredMediaPhoto#4a992157 as nil")
	}
	if .ID == nil {
		return fmt.Errorf("unable to encode inputStickeredMediaPhoto#4a992157: field id is nil")
	}
	if  := .ID.Encode();  != nil {
		return fmt.Errorf("unable to encode inputStickeredMediaPhoto#4a992157: field id: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputStickeredMediaPhoto) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputStickeredMediaPhoto#4a992157 to nil")
	}
	{
		,  := DecodeInputPhoto()
		if  != nil {
			return fmt.Errorf("unable to decode inputStickeredMediaPhoto#4a992157: field id: %w", )
		}
		.ID = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *InputStickeredMediaPhoto) () ( InputPhotoClass) {
	if  == nil {
		return
	}
	return .ID
}

// InputStickeredMediaDocument represents TL type `inputStickeredMediaDocument#438865b`.
// A document with stickers attached
//
// See https://core.telegram.org/constructor/inputStickeredMediaDocument for reference.
type InputStickeredMediaDocument struct {
	// The document
	ID InputDocumentClass
}

// InputStickeredMediaDocumentTypeID is TL type id of InputStickeredMediaDocument.
const InputStickeredMediaDocumentTypeID = 0x438865b

// construct implements constructor of InputStickeredMediaClass.
func ( InputStickeredMediaDocument) () InputStickeredMediaClass { return & }

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

	_ InputStickeredMediaClass = &InputStickeredMediaDocument{}
)

func ( *InputStickeredMediaDocument) () bool {
	if  == nil {
		return true
	}
	if !(.ID == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputStickeredMediaDocument from given interface.
func ( *InputStickeredMediaDocument) ( interface {
	() ( InputDocumentClass)
}) {
	.ID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputStickeredMediaDocument) () tdp.Type {
	 := tdp.Type{
		Name: "inputStickeredMediaDocument",
		ID:   InputStickeredMediaDocumentTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputStickeredMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputStickeredMediaDocument#438865b as nil")
	}
	.PutID(InputStickeredMediaDocumentTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputStickeredMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputStickeredMediaDocument#438865b as nil")
	}
	if .ID == nil {
		return fmt.Errorf("unable to encode inputStickeredMediaDocument#438865b: field id is nil")
	}
	if  := .ID.Encode();  != nil {
		return fmt.Errorf("unable to encode inputStickeredMediaDocument#438865b: field id: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputStickeredMediaDocument) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputStickeredMediaDocument#438865b to nil")
	}
	{
		,  := DecodeInputDocument()
		if  != nil {
			return fmt.Errorf("unable to decode inputStickeredMediaDocument#438865b: field id: %w", )
		}
		.ID = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *InputStickeredMediaDocument) () ( InputDocumentClass) {
	if  == nil {
		return
	}
	return .ID
}

// InputStickeredMediaClassName is schema name of InputStickeredMediaClass.
const InputStickeredMediaClassName = "InputStickeredMedia"

// InputStickeredMediaClass represents InputStickeredMedia generic type.
//
// See https://core.telegram.org/type/InputStickeredMedia for reference.
//
// Example:
//
//	g, err := tg.DecodeInputStickeredMedia(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputStickeredMediaPhoto: // inputStickeredMediaPhoto#4a992157
//	case *tg.InputStickeredMediaDocument: // inputStickeredMediaDocument#438865b
//	default: panic(v)
//	}
type InputStickeredMediaClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputStickeredMediaClass

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

// DecodeInputStickeredMedia implements binary de-serialization for InputStickeredMediaClass.
func ( *bin.Buffer) (InputStickeredMediaClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case InputStickeredMediaPhotoTypeID:
		// Decoding inputStickeredMediaPhoto#4a992157.
		 := InputStickeredMediaPhoto{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputStickeredMediaClass: %w", )
		}
		return &, nil
	case InputStickeredMediaDocumentTypeID:
		// Decoding inputStickeredMediaDocument#438865b.
		 := InputStickeredMediaDocument{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputStickeredMediaClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode InputStickeredMediaClass: %w", bin.NewUnexpectedID())
	}
}

// InputStickeredMedia boxes the InputStickeredMediaClass providing a helper.
type InputStickeredMediaBox struct {
	InputStickeredMedia InputStickeredMediaClass
}

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

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