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

// MessagesInstallStickerSetRequest represents TL type `messages.installStickerSet#c78fe460`.
// Install a stickerset
//
// See https://core.telegram.org/method/messages.installStickerSet for reference.
type MessagesInstallStickerSetRequest struct {
	// Stickerset to install
	Stickerset InputStickerSetClass
	// Whether to archive stickerset
	Archived bool
}

// MessagesInstallStickerSetRequestTypeID is TL type id of MessagesInstallStickerSetRequest.
const MessagesInstallStickerSetRequestTypeID = 0xc78fe460

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

func ( *MessagesInstallStickerSetRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Stickerset == nil) {
		return false
	}
	if !(.Archived == false) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesInstallStickerSetRequest from given interface.
func ( *MessagesInstallStickerSetRequest) ( interface {
	() ( InputStickerSetClass)
	() ( bool)
}) {
	.Stickerset = .()
	.Archived = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesInstallStickerSetRequest) () string {
	return "messages.installStickerSet"
}

// TypeInfo returns info about TL type.
func ( *MessagesInstallStickerSetRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.installStickerSet",
		ID:   MessagesInstallStickerSetRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Stickerset",
			SchemaName: "stickerset",
		},
		{
			Name:       "Archived",
			SchemaName: "archived",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesInstallStickerSetRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.installStickerSet#c78fe460 as nil")
	}
	.PutID(MessagesInstallStickerSetRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesInstallStickerSetRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.installStickerSet#c78fe460 as nil")
	}
	if .Stickerset == nil {
		return fmt.Errorf("unable to encode messages.installStickerSet#c78fe460: field stickerset is nil")
	}
	if  := .Stickerset.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.installStickerSet#c78fe460: field stickerset: %w", )
	}
	.PutBool(.Archived)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesInstallStickerSetRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.installStickerSet#c78fe460 to nil")
	}
	{
		,  := DecodeInputStickerSet()
		if  != nil {
			return fmt.Errorf("unable to decode messages.installStickerSet#c78fe460: field stickerset: %w", )
		}
		.Stickerset = 
	}
	{
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode messages.installStickerSet#c78fe460: field archived: %w", )
		}
		.Archived = 
	}
	return nil
}

// GetStickerset returns value of Stickerset field.
func ( *MessagesInstallStickerSetRequest) () ( InputStickerSetClass) {
	if  == nil {
		return
	}
	return .Stickerset
}

// GetArchived returns value of Archived field.
func ( *MessagesInstallStickerSetRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Archived
}

// MessagesInstallStickerSet invokes method messages.installStickerSet#c78fe460 returning error if any.
// Install a stickerset
//
// Possible errors:
//
//	406 STICKERSET_INVALID: The provided sticker set is invalid.
//
// See https://core.telegram.org/method/messages.installStickerSet for reference.
func ( *Client) ( context.Context,  *MessagesInstallStickerSetRequest) (MessagesStickerSetInstallResultClass, error) {
	var  MessagesStickerSetInstallResultBox

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return .StickerSetInstallResult, nil
}