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

// ContactsDeleteByPhonesRequest represents TL type `contacts.deleteByPhones#1013fd9e`.
// Delete contacts by phone number
//
// See https://core.telegram.org/method/contacts.deleteByPhones for reference.
type ContactsDeleteByPhonesRequest struct {
	// Phone numbers
	Phones []string
}

// ContactsDeleteByPhonesRequestTypeID is TL type id of ContactsDeleteByPhonesRequest.
const ContactsDeleteByPhonesRequestTypeID = 0x1013fd9e

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

func ( *ContactsDeleteByPhonesRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Phones == nil) {
		return false
	}

	return true
}

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

// FillFrom fills ContactsDeleteByPhonesRequest from given interface.
func ( *ContactsDeleteByPhonesRequest) ( interface {
	() ( []string)
}) {
	.Phones = .()
}

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

// TypeName returns name of type in TL schema.
func (*ContactsDeleteByPhonesRequest) () string {
	return "contacts.deleteByPhones"
}

// TypeInfo returns info about TL type.
func ( *ContactsDeleteByPhonesRequest) () tdp.Type {
	 := tdp.Type{
		Name: "contacts.deleteByPhones",
		ID:   ContactsDeleteByPhonesRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Phones",
			SchemaName: "phones",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ContactsDeleteByPhonesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contacts.deleteByPhones#1013fd9e as nil")
	}
	.PutID(ContactsDeleteByPhonesRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ContactsDeleteByPhonesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contacts.deleteByPhones#1013fd9e as nil")
	}
	.PutVectorHeader(len(.Phones))
	for ,  := range .Phones {
		.PutString()
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *ContactsDeleteByPhonesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode contacts.deleteByPhones#1013fd9e to nil")
	}
	if  := .ConsumeID(ContactsDeleteByPhonesRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode contacts.deleteByPhones#1013fd9e: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ContactsDeleteByPhonesRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode contacts.deleteByPhones#1013fd9e to nil")
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode contacts.deleteByPhones#1013fd9e: field phones: %w", )
		}

		if  > 0 {
			.Phones = make([]string, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .String()
			if  != nil {
				return fmt.Errorf("unable to decode contacts.deleteByPhones#1013fd9e: field phones: %w", )
			}
			.Phones = append(.Phones, )
		}
	}
	return nil
}

// GetPhones returns value of Phones field.
func ( *ContactsDeleteByPhonesRequest) () ( []string) {
	if  == nil {
		return
	}
	return .Phones
}

// ContactsDeleteByPhones invokes method contacts.deleteByPhones#1013fd9e returning error if any.
// Delete contacts by phone number
//
// See https://core.telegram.org/method/contacts.deleteByPhones for reference.
func ( *Client) ( context.Context,  []string) (bool, error) {
	var  BoolBox

	 := &ContactsDeleteByPhonesRequest{
		Phones: ,
	}
	if  := .rpc.Invoke(, , &);  != nil {
		return false, 
	}
	,  := .Bool.(*BoolTrue)
	return , nil
}