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

// MessagesEditChatDefaultBannedRightsRequest represents TL type `messages.editChatDefaultBannedRights#a5866b41`.
// Edit the default banned rights of a channel/supergroup/groupĀ¹.
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/method/messages.editChatDefaultBannedRights for reference.
type MessagesEditChatDefaultBannedRightsRequest struct {
	// The peer
	Peer InputPeerClass
	// The new global rights
	BannedRights ChatBannedRights
}

// MessagesEditChatDefaultBannedRightsRequestTypeID is TL type id of MessagesEditChatDefaultBannedRightsRequest.
const MessagesEditChatDefaultBannedRightsRequestTypeID = 0xa5866b41

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

func ( *MessagesEditChatDefaultBannedRightsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.BannedRights.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesEditChatDefaultBannedRightsRequest from given interface.
func ( *MessagesEditChatDefaultBannedRightsRequest) ( interface {
	() ( InputPeerClass)
	() ( ChatBannedRights)
}) {
	.Peer = .()
	.BannedRights = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesEditChatDefaultBannedRightsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.editChatDefaultBannedRights",
		ID:   MessagesEditChatDefaultBannedRightsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "BannedRights",
			SchemaName: "banned_rights",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesEditChatDefaultBannedRightsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.editChatDefaultBannedRights#a5866b41 as nil")
	}
	.PutID(MessagesEditChatDefaultBannedRightsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesEditChatDefaultBannedRightsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.editChatDefaultBannedRights#a5866b41 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.editChatDefaultBannedRights#a5866b41: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.editChatDefaultBannedRights#a5866b41: field peer: %w", )
	}
	if  := .BannedRights.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.editChatDefaultBannedRights#a5866b41: field banned_rights: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesEditChatDefaultBannedRightsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.editChatDefaultBannedRights#a5866b41 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editChatDefaultBannedRights#a5866b41: field peer: %w", )
		}
		.Peer = 
	}
	{
		if  := .BannedRights.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.editChatDefaultBannedRights#a5866b41: field banned_rights: %w", )
		}
	}
	return nil
}

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

// GetBannedRights returns value of BannedRights field.
func ( *MessagesEditChatDefaultBannedRightsRequest) () ( ChatBannedRights) {
	if  == nil {
		return
	}
	return .BannedRights
}

// MessagesEditChatDefaultBannedRights invokes method messages.editChatDefaultBannedRights#a5866b41 returning error if any.
// Edit the default banned rights of a channel/supergroup/groupĀ¹.
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// Possible errors:
//
//	400 BANNED_RIGHTS_INVALID: You provided some invalid flags in the banned rights.
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	400 CHAT_ID_INVALID: The provided chat id is invalid.
//	400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information.
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//	400 UNTIL_DATE_INVALID: Invalid until date provided.
//
// See https://core.telegram.org/method/messages.editChatDefaultBannedRights for reference.
// Can be used by bots.
func ( *Client) ( context.Context,  *MessagesEditChatDefaultBannedRightsRequest) (UpdatesClass, error) {
	var  UpdatesBox

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