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

// InputFolderPeer represents TL type `inputFolderPeer#fbd2c296`.
// Peer in a folder
//
// See https://core.telegram.org/constructor/inputFolderPeer for reference.
type InputFolderPeer struct {
	// Peer
	Peer InputPeerClass
	// Peer folder ID, for more info click hereĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/api/folders#peer-folders
	FolderID int
}

// InputFolderPeerTypeID is TL type id of InputFolderPeer.
const InputFolderPeerTypeID = 0xfbd2c296

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

func ( *InputFolderPeer) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.FolderID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills InputFolderPeer from given interface.
func ( *InputFolderPeer) ( interface {
	() ( InputPeerClass)
	() ( int)
}) {
	.Peer = .()
	.FolderID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *InputFolderPeer) () tdp.Type {
	 := tdp.Type{
		Name: "inputFolderPeer",
		ID:   InputFolderPeerTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "FolderID",
			SchemaName: "folder_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputFolderPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputFolderPeer#fbd2c296 as nil")
	}
	.PutID(InputFolderPeerTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputFolderPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputFolderPeer#fbd2c296 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode inputFolderPeer#fbd2c296: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode inputFolderPeer#fbd2c296: field peer: %w", )
	}
	.PutInt(.FolderID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputFolderPeer) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputFolderPeer#fbd2c296 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode inputFolderPeer#fbd2c296: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode inputFolderPeer#fbd2c296: field folder_id: %w", )
		}
		.FolderID = 
	}
	return nil
}

// GetPeer returns value of Peer field.
func ( *InputFolderPeer) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// GetFolderID returns value of FolderID field.
func ( *InputFolderPeer) () ( int) {
	if  == nil {
		return
	}
	return .FolderID
}