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

// MessagesEditChatCreatorRequest represents TL type `messages.editChatCreator#f743b857`.
// Transfer the ownership of a basic group, supergroup or channel to another user, see
// here »¹ for the full flow.
//
// Links:
//  1. https://core.telegram.org/api/channel#transferring-ownership-of-a-group-channel
//
// See https://core.telegram.org/method/messages.editChatCreator for reference.
type MessagesEditChatCreatorRequest struct {
	// Owned group/supergroup/channel.
	Peer InputPeerClass
	// ID of the new owner.
	UserID InputUserClass
	// The current account's 2FA password¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/srp
	Password InputCheckPasswordSRPClass
}

// MessagesEditChatCreatorRequestTypeID is TL type id of MessagesEditChatCreatorRequest.
const MessagesEditChatCreatorRequestTypeID = 0xf743b857

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

func ( *MessagesEditChatCreatorRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.UserID == nil) {
		return false
	}
	if !(.Password == nil) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesEditChatCreatorRequest from given interface.
func ( *MessagesEditChatCreatorRequest) ( interface {
	() ( InputPeerClass)
	() ( InputUserClass)
	() ( InputCheckPasswordSRPClass)
}) {
	.Peer = .()
	.UserID = .()
	.Password = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MessagesEditChatCreatorRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.editChatCreator",
		ID:   MessagesEditChatCreatorRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Password",
			SchemaName: "password",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MessagesEditChatCreatorRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.editChatCreator#f743b857 as nil")
	}
	.PutID(MessagesEditChatCreatorRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesEditChatCreatorRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.editChatCreator#f743b857 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field peer: %w", )
	}
	if .UserID == nil {
		return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field user_id: %w", )
	}
	if .Password == nil {
		return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field password is nil")
	}
	if  := .Password.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.editChatCreator#f743b857: field password: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MessagesEditChatCreatorRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.editChatCreator#f743b857 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editChatCreator#f743b857: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editChatCreator#f743b857: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := DecodeInputCheckPasswordSRP()
		if  != nil {
			return fmt.Errorf("unable to decode messages.editChatCreator#f743b857: field password: %w", )
		}
		.Password = 
	}
	return nil
}

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

// GetUserID returns value of UserID field.
func ( *MessagesEditChatCreatorRequest) () ( InputUserClass) {
	if  == nil {
		return
	}
	return .UserID
}

// GetPassword returns value of Password field.
func ( *MessagesEditChatCreatorRequest) () ( InputCheckPasswordSRPClass) {
	if  == nil {
		return
	}
	return .Password
}

// GetPasswordAsNotEmpty returns mapped value of Password field.
func ( *MessagesEditChatCreatorRequest) () (*InputCheckPasswordSRP, bool) {
	return .Password.AsNotEmpty()
}

// MessagesEditChatCreator invokes method messages.editChatCreator#f743b857 returning error if any.
// Transfer the ownership of a basic group, supergroup or channel to another user, see
// here »¹ for the full flow.
//
// Links:
//  1. https://core.telegram.org/api/channel#transferring-ownership-of-a-group-channel
//
// Possible errors:
//
//	400 CHANNELS_ADMIN_PUBLIC_TOO_MUCH: You're admin of too many public channels, make some channels private to change the username of this channel.
//	400 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	400 CHAT_MEMBER_ADD_FAILED: Could not add participants.
//	400 INPUT_USER_DEACTIVATED: The specified user was deleted.
//	400 PASSWORD_HASH_INVALID: The provided password hash is invalid.
//	400 PASSWORD_MISSING: You must enable 2FA before executing this operation.
//	400 PASSWORD_TOO_FRESH_%d: The password was modified less than 24 hours ago, try again in %d seconds.
//	400 SESSION_TOO_FRESH_%d: This session was created less than 24 hours ago, try again in %d seconds.
//	400 SRP_ID_INVALID: Invalid SRP ID provided.
//	400 USERS_TOO_MUCH: The maximum number of users has been exceeded (to create a chat, for example).
//	403 USER_CHANNELS_TOO_MUCH: One of the users you tried to add is already in too many channels/supergroups.
//	400 USER_NOT_MUTUAL_CONTACT: The provided user is not a mutual contact.
//	403 USER_PRIVACY_RESTRICTED: The user's privacy settings do not allow you to do this.
//
// See https://core.telegram.org/method/messages.editChatCreator for reference.
func ( *Client) ( context.Context,  *MessagesEditChatCreatorRequest) (UpdatesClass, error) {
	var  UpdatesBox

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