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

// AccountUpdatePersonalChannelRequest represents TL type `account.updatePersonalChannel#d94305e0`.
// Associate (or remove) a personal channel »¹, that will be listed on our personal
// profile page »².
// Changing it will emit an updateUser¹ update.
//
// Links:
//  1. https://core.telegram.org/api/channel
//  2. https://core.telegram.org/api/profile#personal-channel
//  3. https://core.telegram.org/constructor/updateUser
//
// See https://core.telegram.org/method/account.updatePersonalChannel for reference.
type AccountUpdatePersonalChannelRequest struct {
	// The channel, pass inputChannelEmpty¹ to remove it.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/inputChannelEmpty
	Channel InputChannelClass
}

// AccountUpdatePersonalChannelRequestTypeID is TL type id of AccountUpdatePersonalChannelRequest.
const AccountUpdatePersonalChannelRequestTypeID = 0xd94305e0

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

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

	return true
}

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

// FillFrom fills AccountUpdatePersonalChannelRequest from given interface.
func ( *AccountUpdatePersonalChannelRequest) ( interface {
	() ( InputChannelClass)
}) {
	.Channel = .()
}

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

// TypeName returns name of type in TL schema.
func (*AccountUpdatePersonalChannelRequest) () string {
	return "account.updatePersonalChannel"
}

// TypeInfo returns info about TL type.
func ( *AccountUpdatePersonalChannelRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.updatePersonalChannel",
		ID:   AccountUpdatePersonalChannelRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Channel",
			SchemaName: "channel",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *AccountUpdatePersonalChannelRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.updatePersonalChannel#d94305e0 as nil")
	}
	.PutID(AccountUpdatePersonalChannelRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountUpdatePersonalChannelRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.updatePersonalChannel#d94305e0 as nil")
	}
	if .Channel == nil {
		return fmt.Errorf("unable to encode account.updatePersonalChannel#d94305e0: field channel is nil")
	}
	if  := .Channel.Encode();  != nil {
		return fmt.Errorf("unable to encode account.updatePersonalChannel#d94305e0: field channel: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountUpdatePersonalChannelRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.updatePersonalChannel#d94305e0 to nil")
	}
	if  := .ConsumeID(AccountUpdatePersonalChannelRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.updatePersonalChannel#d94305e0: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountUpdatePersonalChannelRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.updatePersonalChannel#d94305e0 to nil")
	}
	{
		,  := DecodeInputChannel()
		if  != nil {
			return fmt.Errorf("unable to decode account.updatePersonalChannel#d94305e0: field channel: %w", )
		}
		.Channel = 
	}
	return nil
}

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

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

// AccountUpdatePersonalChannel invokes method account.updatePersonalChannel#d94305e0 returning error if any.
// Associate (or remove) a personal channel »¹, that will be listed on our personal
// profile page »².
// Changing it will emit an updateUser¹ update.
//
// Links:
//  1. https://core.telegram.org/api/channel
//  2. https://core.telegram.org/api/profile#personal-channel
//  3. https://core.telegram.org/constructor/updateUser
//
// See https://core.telegram.org/method/account.updatePersonalChannel for reference.
func ( *Client) ( context.Context,  InputChannelClass) (bool, error) {
	var  BoolBox

	 := &AccountUpdatePersonalChannelRequest{
		Channel: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}