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

// ChannelsToggleSignaturesRequest represents TL type `channels.toggleSignatures#1f69b606`.
// Enable/disable message signatures in channels
//
// See https://core.telegram.org/method/channels.toggleSignatures for reference.
type ChannelsToggleSignaturesRequest struct {
	// Channel
	Channel InputChannelClass
	// Value
	Enabled bool
}

// ChannelsToggleSignaturesRequestTypeID is TL type id of ChannelsToggleSignaturesRequest.
const ChannelsToggleSignaturesRequestTypeID = 0x1f69b606

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *ChannelsToggleSignaturesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.toggleSignatures#1f69b606 as nil")
	}
	.PutID(ChannelsToggleSignaturesRequestTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *ChannelsToggleSignaturesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.toggleSignatures#1f69b606 to nil")
	}
	{
		,  := DecodeInputChannel()
		if  != nil {
			return fmt.Errorf("unable to decode channels.toggleSignatures#1f69b606: field channel: %w", )
		}
		.Channel = 
	}
	{
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode channels.toggleSignatures#1f69b606: field enabled: %w", )
		}
		.Enabled = 
	}
	return nil
}

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

// GetEnabled returns value of Enabled field.
func ( *ChannelsToggleSignaturesRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Enabled
}

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

// ChannelsToggleSignatures invokes method channels.toggleSignatures#1f69b606 returning error if any.
// Enable/disable message signatures in channels
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	400 CHAT_ADMIN_REQUIRED: You must be an admin in this chat to do this.
//	400 CHAT_ID_INVALID: The provided chat id is invalid.
//	400 CHAT_NOT_MODIFIED: No changes were made to chat information because the new information you passed is identical to the current information.
//
// See https://core.telegram.org/method/channels.toggleSignatures for reference.
func ( *Client) ( context.Context,  *ChannelsToggleSignaturesRequest) (UpdatesClass, error) {
	var  UpdatesBox

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