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

// MessagesEditChatParticipantRankRequest represents TL type `messages.editChatParticipantRank#a00f32b0`.
// Edit a group participant's tag »¹.
//
// Links:
//  1. https://core.telegram.org/api/rank
//
// See https://core.telegram.org/method/messages.editChatParticipantRank for reference.
type MessagesEditChatParticipantRankRequest struct {
	// The basic group/supergroup.
	Peer InputPeerClass
	// The participant.
	Participant InputPeerClass
	// The new tag.
	Rank string
}

// MessagesEditChatParticipantRankRequestTypeID is TL type id of MessagesEditChatParticipantRankRequest.
const MessagesEditChatParticipantRankRequestTypeID = 0xa00f32b0

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

func ( *MessagesEditChatParticipantRankRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.Participant == nil) {
		return false
	}
	if !(.Rank == "") {
		return false
	}

	return true
}

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

// FillFrom fills MessagesEditChatParticipantRankRequest from given interface.
func ( *MessagesEditChatParticipantRankRequest) ( interface {
	() ( InputPeerClass)
	() ( InputPeerClass)
	() ( string)
}) {
	.Peer = .()
	.Participant = .()
	.Rank = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesEditChatParticipantRankRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.editChatParticipantRank",
		ID:   MessagesEditChatParticipantRankRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "Participant",
			SchemaName: "participant",
		},
		{
			Name:       "Rank",
			SchemaName: "rank",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesEditChatParticipantRankRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.editChatParticipantRank#a00f32b0 as nil")
	}
	.PutID(MessagesEditChatParticipantRankRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesEditChatParticipantRankRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.editChatParticipantRank#a00f32b0 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field peer: %w", )
	}
	if .Participant == nil {
		return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field participant is nil")
	}
	if  := .Participant.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.editChatParticipantRank#a00f32b0: field participant: %w", )
	}
	.PutString(.Rank)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesEditChatParticipantRankRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.editChatParticipantRank#a00f32b0 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editChatParticipantRank#a00f32b0: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editChatParticipantRank#a00f32b0: field participant: %w", )
		}
		.Participant = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editChatParticipantRank#a00f32b0: field rank: %w", )
		}
		.Rank = 
	}
	return nil
}

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

// GetParticipant returns value of Participant field.
func ( *MessagesEditChatParticipantRankRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Participant
}

// GetRank returns value of Rank field.
func ( *MessagesEditChatParticipantRankRequest) () ( string) {
	if  == nil {
		return
	}
	return .Rank
}

// MessagesEditChatParticipantRank invokes method messages.editChatParticipantRank#a00f32b0 returning error if any.
// Edit a group participant's tag »¹.
//
// Links:
//  1. https://core.telegram.org/api/rank
//
// See https://core.telegram.org/method/messages.editChatParticipantRank for reference.
func ( *Client) ( context.Context,  *MessagesEditChatParticipantRankRequest) (UpdatesClass, error) {
	var  UpdatesBox

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