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

// ChannelsDeleteChannelRequest represents TL type `channels.deleteChannel#c0111fe3`.
// Delete a channel/supergroup¹
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// See https://core.telegram.org/method/channels.deleteChannel for reference.
type ChannelsDeleteChannelRequest struct {
	// Channel/supergroup¹ to delete
	//
	// Links:
	//  1) https://core.telegram.org/api/channel
	Channel InputChannelClass
}

// ChannelsDeleteChannelRequestTypeID is TL type id of ChannelsDeleteChannelRequest.
const ChannelsDeleteChannelRequestTypeID = 0xc0111fe3

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *ChannelsDeleteChannelRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.deleteChannel#c0111fe3 as nil")
	}
	.PutID(ChannelsDeleteChannelRequestTypeID)
	return .EncodeBare()
}

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

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

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

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

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

// ChannelsDeleteChannel invokes method channels.deleteChannel#c0111fe3 returning error if any.
// Delete a channel/supergroup¹
//
// Links:
//  1. https://core.telegram.org/api/channel
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	406 CHANNEL_PRIVATE: You haven't joined this channel/supergroup.
//	406 CHANNEL_TOO_LARGE: Channel is too large to be deleted; this error is issued when trying to delete channels with more than 1000 members (subject to change).
//	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.
//
// See https://core.telegram.org/method/channels.deleteChannel for reference.
func ( *Client) ( context.Context,  InputChannelClass) (UpdatesClass, error) {
	var  UpdatesBox

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