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

// ChannelsDeleteParticipantHistoryRequest represents TL type `channels.deleteParticipantHistory#367544db`.
// Delete all messages sent by a specific participant of a given supergroup
//
// See https://core.telegram.org/method/channels.deleteParticipantHistory for reference.
type ChannelsDeleteParticipantHistoryRequest struct {
	// Supergroup
	Channel InputChannelClass
	// The participant whose messages should be deleted
	Participant InputPeerClass
}

// ChannelsDeleteParticipantHistoryRequestTypeID is TL type id of ChannelsDeleteParticipantHistoryRequest.
const ChannelsDeleteParticipantHistoryRequestTypeID = 0x367544db

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

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

	return true
}

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

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

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

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

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

// Encode implements bin.Encoder.
func ( *ChannelsDeleteParticipantHistoryRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode channels.deleteParticipantHistory#367544db as nil")
	}
	.PutID(ChannelsDeleteParticipantHistoryRequestTypeID)
	return .EncodeBare()
}

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

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

// DecodeBare implements bin.BareDecoder.
func ( *ChannelsDeleteParticipantHistoryRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode channels.deleteParticipantHistory#367544db to nil")
	}
	{
		,  := DecodeInputChannel()
		if  != nil {
			return fmt.Errorf("unable to decode channels.deleteParticipantHistory#367544db: field channel: %w", )
		}
		.Channel = 
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode channels.deleteParticipantHistory#367544db: field participant: %w", )
		}
		.Participant = 
	}
	return nil
}

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

// GetParticipant returns value of Participant field.
func ( *ChannelsDeleteParticipantHistoryRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Participant
}

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

// ChannelsDeleteParticipantHistory invokes method channels.deleteParticipantHistory#367544db returning error if any.
// Delete all messages sent by a specific participant of a given supergroup
//
// Possible errors:
//
//	400 CHANNEL_INVALID: The provided channel is invalid.
//	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.
//	403 CHAT_WRITE_FORBIDDEN: You can't write in this chat.
//	400 MSG_ID_INVALID: Invalid message ID provided.
//	400 PARTICIPANT_ID_INVALID: The specified participant ID is invalid.
//
// See https://core.telegram.org/method/channels.deleteParticipantHistory for reference.
func ( *Client) ( context.Context,  *ChannelsDeleteParticipantHistoryRequest) (*MessagesAffectedHistory, error) {
	var  MessagesAffectedHistory

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