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

// ChannelsEditCreatorRequest represents TL type `channels.editCreator#8f38cd1f`.
// Transfer channel ownership
//
// See https://core.telegram.org/method/channels.editCreator for reference.
type ChannelsEditCreatorRequest struct {
	// Channel
	Channel InputChannelClass
	// New channel owner
	UserID InputUserClass
	// 2FA password¹ of account
	//
	// Links:
	//  1) https://core.telegram.org/api/srp
	Password InputCheckPasswordSRPClass
}

// ChannelsEditCreatorRequestTypeID is TL type id of ChannelsEditCreatorRequest.
const ChannelsEditCreatorRequestTypeID = 0x8f38cd1f

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

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

	return true
}

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

// FillFrom fills ChannelsEditCreatorRequest from given interface.
func ( *ChannelsEditCreatorRequest) ( interface {
	() ( InputChannelClass)
	() ( InputUserClass)
	() ( InputCheckPasswordSRPClass)
}) {
	.Channel = .()
	.UserID = .()
	.Password = .()
}

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

// TypeName returns name of type in TL schema.
func (*ChannelsEditCreatorRequest) () string {
	return "channels.editCreator"
}

// TypeInfo returns info about TL type.
func ( *ChannelsEditCreatorRequest) () tdp.Type {
	 := tdp.Type{
		Name: "channels.editCreator",
		ID:   ChannelsEditCreatorRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channel",
			SchemaName: "channel",
		},
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "Password",
			SchemaName: "password",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ChannelsEditCreatorRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.editCreator#8f38cd1f as nil")
	}
	.PutID(ChannelsEditCreatorRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ChannelsEditCreatorRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.editCreator#8f38cd1f as nil")
	}
	if .Channel == nil {
		return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field channel is nil")
	}
	if  := .Channel.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field channel: %w", )
	}
	if .UserID == nil {
		return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field user_id is nil")
	}
	if  := .UserID.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field user_id: %w", )
	}
	if .Password == nil {
		return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field password is nil")
	}
	if  := .Password.Encode();  != nil {
		return fmt.Errorf("unable to encode channels.editCreator#8f38cd1f: field password: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *ChannelsEditCreatorRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.editCreator#8f38cd1f to nil")
	}
	if  := .ConsumeID(ChannelsEditCreatorRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ChannelsEditCreatorRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.editCreator#8f38cd1f to nil")
	}
	{
		,  := DecodeInputChannel()
		if  != nil {
			return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: field channel: %w", )
		}
		.Channel = 
	}
	{
		,  := DecodeInputUser()
		if  != nil {
			return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := DecodeInputCheckPasswordSRP()
		if  != nil {
			return fmt.Errorf("unable to decode channels.editCreator#8f38cd1f: field password: %w", )
		}
		.Password = 
	}
	return nil
}

// GetChannel returns value of Channel field.
func ( *ChannelsEditCreatorRequest) () ( InputChannelClass) {
	if  == nil {
		return
	}
	return .Channel
}

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

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

// GetChannelAsNotEmpty returns mapped value of Channel field.
func ( *ChannelsEditCreatorRequest) () (NotEmptyInputChannel, bool) {
	return .Channel.AsNotEmpty()
}

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

// ChannelsEditCreator invokes method channels.editCreator#8f38cd1f returning error if any.
// Transfer channel ownership
//
// 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_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 PASSWORD_HASH_INVALID: The provided password hash is invalid.
//	400 PASSWORD_MISSING: You must enable 2FA in order to transfer ownership of a channel.
//	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 USER_ID_INVALID: The provided user ID is invalid.
//
// See https://core.telegram.org/method/channels.editCreator for reference.
func ( *Client) ( context.Context,  *ChannelsEditCreatorRequest) (UpdatesClass, error) {
	var  UpdatesBox

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