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

// InputWallPaper represents TL type `inputWallPaper#e630b979`.
// Wallpaper¹
//
// Links:
//  1. https://core.telegram.org/api/wallpapers
//
// See https://core.telegram.org/constructor/inputWallPaper for reference.
type InputWallPaper struct {
	// Wallpaper¹ ID
	//
	// Links:
	//  1) https://core.telegram.org/api/wallpapers
	ID int64
	// Access hash
	AccessHash int64
}

// InputWallPaperTypeID is TL type id of InputWallPaper.
const InputWallPaperTypeID = 0xe630b979

// construct implements constructor of InputWallPaperClass.
func ( InputWallPaper) () InputWallPaperClass { return & }

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

	_ InputWallPaperClass = &InputWallPaper{}
)

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

	return true
}

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

// FillFrom fills InputWallPaper from given interface.
func ( *InputWallPaper) ( interface {
	() ( int64)
	() ( int64)
}) {
	.ID = .()
	.AccessHash = .()
}

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

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

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

// Encode implements bin.Encoder.
func ( *InputWallPaper) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputWallPaper#e630b979 as nil")
	}
	.PutID(InputWallPaperTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputWallPaper) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputWallPaper#e630b979 as nil")
	}
	.PutLong(.ID)
	.PutLong(.AccessHash)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputWallPaper) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputWallPaper#e630b979 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputWallPaper#e630b979: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputWallPaper#e630b979: field access_hash: %w", )
		}
		.AccessHash = 
	}
	return nil
}

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

// GetAccessHash returns value of AccessHash field.
func ( *InputWallPaper) () ( int64) {
	if  == nil {
		return
	}
	return .AccessHash
}

// InputWallPaperSlug represents TL type `inputWallPaperSlug#72091c80`.
// Wallpaper¹ by slug (a unique ID, obtained from a wallpaper link »²)
//
// Links:
//  1. https://core.telegram.org/api/wallpapers
//  2. https://core.telegram.org/api/links#wallpaper-links
//
// See https://core.telegram.org/constructor/inputWallPaperSlug for reference.
type InputWallPaperSlug struct {
	// Unique wallpaper ID
	Slug string
}

// InputWallPaperSlugTypeID is TL type id of InputWallPaperSlug.
const InputWallPaperSlugTypeID = 0x72091c80

// construct implements constructor of InputWallPaperClass.
func ( InputWallPaperSlug) () InputWallPaperClass { return & }

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

	_ InputWallPaperClass = &InputWallPaperSlug{}
)

func ( *InputWallPaperSlug) () bool {
	if  == nil {
		return true
	}
	if !(.Slug == "") {
		return false
	}

	return true
}

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

// FillFrom fills InputWallPaperSlug from given interface.
func ( *InputWallPaperSlug) ( interface {
	() ( string)
}) {
	.Slug = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputWallPaperSlug) () tdp.Type {
	 := tdp.Type{
		Name: "inputWallPaperSlug",
		ID:   InputWallPaperSlugTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Slug",
			SchemaName: "slug",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputWallPaperSlug) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputWallPaperSlug#72091c80 as nil")
	}
	.PutID(InputWallPaperSlugTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputWallPaperSlug) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputWallPaperSlug#72091c80 as nil")
	}
	.PutString(.Slug)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputWallPaperSlug) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputWallPaperSlug#72091c80 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputWallPaperSlug#72091c80: field slug: %w", )
		}
		.Slug = 
	}
	return nil
}

// GetSlug returns value of Slug field.
func ( *InputWallPaperSlug) () ( string) {
	if  == nil {
		return
	}
	return .Slug
}

// InputWallPaperNoFile represents TL type `inputWallPaperNoFile#967a462e`.
// Wallpaper¹ with no file access hash, used for example when deleting (unsave=true)
// wallpapers using account.saveWallPaper², specifying just the wallpaper ID.
//
// Links:
//  1. https://core.telegram.org/api/wallpapers
//  2. https://core.telegram.org/method/account.saveWallPaper
//
// See https://core.telegram.org/constructor/inputWallPaperNoFile for reference.
type InputWallPaperNoFile struct {
	// Wallpaper ID
	ID int64
}

// InputWallPaperNoFileTypeID is TL type id of InputWallPaperNoFile.
const InputWallPaperNoFileTypeID = 0x967a462e

// construct implements constructor of InputWallPaperClass.
func ( InputWallPaperNoFile) () InputWallPaperClass { return & }

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

	_ InputWallPaperClass = &InputWallPaperNoFile{}
)

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

	return true
}

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

// FillFrom fills InputWallPaperNoFile from given interface.
func ( *InputWallPaperNoFile) ( interface {
	() ( int64)
}) {
	.ID = .()
}

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

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

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

// Encode implements bin.Encoder.
func ( *InputWallPaperNoFile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputWallPaperNoFile#967a462e as nil")
	}
	.PutID(InputWallPaperNoFileTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputWallPaperNoFile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputWallPaperNoFile#967a462e as nil")
	}
	.PutLong(.ID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputWallPaperNoFile) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputWallPaperNoFile#967a462e to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputWallPaperNoFile#967a462e: field id: %w", )
		}
		.ID = 
	}
	return nil
}

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

// InputWallPaperClassName is schema name of InputWallPaperClass.
const InputWallPaperClassName = "InputWallPaper"

// InputWallPaperClass represents InputWallPaper generic type.
//
// See https://core.telegram.org/type/InputWallPaper for reference.
//
// Example:
//
//	g, err := tg.DecodeInputWallPaper(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.InputWallPaper: // inputWallPaper#e630b979
//	case *tg.InputWallPaperSlug: // inputWallPaperSlug#72091c80
//	case *tg.InputWallPaperNoFile: // inputWallPaperNoFile#967a462e
//	default: panic(v)
//	}
type InputWallPaperClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() InputWallPaperClass

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

// DecodeInputWallPaper implements binary de-serialization for InputWallPaperClass.
func ( *bin.Buffer) (InputWallPaperClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case InputWallPaperTypeID:
		// Decoding inputWallPaper#e630b979.
		 := InputWallPaper{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputWallPaperClass: %w", )
		}
		return &, nil
	case InputWallPaperSlugTypeID:
		// Decoding inputWallPaperSlug#72091c80.
		 := InputWallPaperSlug{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputWallPaperClass: %w", )
		}
		return &, nil
	case InputWallPaperNoFileTypeID:
		// Decoding inputWallPaperNoFile#967a462e.
		 := InputWallPaperNoFile{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode InputWallPaperClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode InputWallPaperClass: %w", bin.NewUnexpectedID())
	}
}

// InputWallPaper boxes the InputWallPaperClass providing a helper.
type InputWallPaperBox struct {
	InputWallPaper InputWallPaperClass
}

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

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