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

// MessagesDeletePhoneCallHistoryRequest represents TL type `messages.deletePhoneCallHistory#f9cbe409`.
// Delete the entire phone call history.
//
// See https://core.telegram.org/method/messages.deletePhoneCallHistory for reference.
type MessagesDeletePhoneCallHistoryRequest struct {
	// Flags, see TL conditional fieldsĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether to remove phone call history for participants as well
	Revoke bool
}

// MessagesDeletePhoneCallHistoryRequestTypeID is TL type id of MessagesDeletePhoneCallHistoryRequest.
const MessagesDeletePhoneCallHistoryRequestTypeID = 0xf9cbe409

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

func ( *MessagesDeletePhoneCallHistoryRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Revoke == false) {
		return false
	}

	return true
}

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

// FillFrom fills MessagesDeletePhoneCallHistoryRequest from given interface.
func ( *MessagesDeletePhoneCallHistoryRequest) ( interface {
	() ( bool)
}) {
	.Revoke = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesDeletePhoneCallHistoryRequest) () string {
	return "messages.deletePhoneCallHistory"
}

// TypeInfo returns info about TL type.
func ( *MessagesDeletePhoneCallHistoryRequest) () tdp.Type {
	 := tdp.Type{
		Name: "messages.deletePhoneCallHistory",
		ID:   MessagesDeletePhoneCallHistoryRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Revoke",
			SchemaName: "revoke",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesDeletePhoneCallHistoryRequest) () {
	if !(.Revoke == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesDeletePhoneCallHistoryRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.deletePhoneCallHistory#f9cbe409 as nil")
	}
	.PutID(MessagesDeletePhoneCallHistoryRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesDeletePhoneCallHistoryRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.deletePhoneCallHistory#f9cbe409 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.deletePhoneCallHistory#f9cbe409: field flags: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesDeletePhoneCallHistoryRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.deletePhoneCallHistory#f9cbe409 to nil")
	}
	if  := .ConsumeID(MessagesDeletePhoneCallHistoryRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.deletePhoneCallHistory#f9cbe409: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesDeletePhoneCallHistoryRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.deletePhoneCallHistory#f9cbe409 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.deletePhoneCallHistory#f9cbe409: field flags: %w", )
		}
	}
	.Revoke = .Flags.Has(0)
	return nil
}

// SetRevoke sets value of Revoke conditional field.
func ( *MessagesDeletePhoneCallHistoryRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.Revoke = true
	} else {
		.Flags.Unset(0)
		.Revoke = false
	}
}

// GetRevoke returns value of Revoke conditional field.
func ( *MessagesDeletePhoneCallHistoryRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// MessagesDeletePhoneCallHistory invokes method messages.deletePhoneCallHistory#f9cbe409 returning error if any.
// Delete the entire phone call history.
//
// See https://core.telegram.org/method/messages.deletePhoneCallHistory for reference.
func ( *Client) ( context.Context,  *MessagesDeletePhoneCallHistoryRequest) (*MessagesAffectedFoundMessages, error) {
	var  MessagesAffectedFoundMessages

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