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

// ChannelsConvertToGigagroupRequest represents TL type `channels.convertToGigagroup#b290c69`.
// Convert a supergroup¹ to a gigagroup², when requested by channel suggestions³.
//
// Links:
//  1. https://core.telegram.org/api/channel
//  2. https://core.telegram.org/api/channel
//  3. https://core.telegram.org/api/config#channel-suggestions
//
// See https://core.telegram.org/method/channels.convertToGigagroup for reference.
type ChannelsConvertToGigagroupRequest struct {
	// The supergroup¹ to convert
	//
	// Links:
	//  1) https://core.telegram.org/api/channel
	Channel InputChannelClass
}

// ChannelsConvertToGigagroupRequestTypeID is TL type id of ChannelsConvertToGigagroupRequest.
const ChannelsConvertToGigagroupRequestTypeID = 0xb290c69

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *ChannelsConvertToGigagroupRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.convertToGigagroup#b290c69 as nil")
	}
	.PutID(ChannelsConvertToGigagroupRequestTypeID)
	return .EncodeBare()
}

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

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

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

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

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

// ChannelsConvertToGigagroup invokes method channels.convertToGigagroup#b290c69 returning error if any.
// Convert a supergroup¹ to a gigagroup², when requested by channel suggestions³.
//
// Links:
//  1. https://core.telegram.org/api/channel
//  2. https://core.telegram.org/api/channel
//  3. https://core.telegram.org/api/config#channel-suggestions
//
// Possible errors:
//
//	400 CHANNEL_ID_INVALID: The specified supergroup ID is invalid.
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	400 FORUM_ENABLED: You can't execute the specified action because the group is a forum, disable forum functionality to continue.
//	400 PARTICIPANTS_TOO_FEW: Not enough participants.
//
// See https://core.telegram.org/method/channels.convertToGigagroup for reference.
func ( *Client) ( context.Context,  InputChannelClass) (UpdatesClass, error) {
	var  UpdatesBox

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