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

// InputPhoneContact represents TL type `inputPhoneContact#f392b7f4`.
// Phone contact.
//
// See https://core.telegram.org/constructor/inputPhoneContact for reference.
type InputPhoneContact struct {
	// An arbitrary 64-bit integer: it should be set, for example, to an incremental number
	// when using contacts.importContacts¹, in order to retry importing only the contacts
	// that weren't imported successfully, according to the client_ids returned in contacts
	// importedContacts².retry_contacts.
	//
	// Links:
	//  1) https://core.telegram.org/method/contacts.importContacts
	//  2) https://core.telegram.org/constructor/contacts.importedContacts
	ClientID int64
	// Phone number
	Phone string
	// Contact's first name
	FirstName string
	// Contact's last name
	LastName string
}

// InputPhoneContactTypeID is TL type id of InputPhoneContact.
const InputPhoneContactTypeID = 0xf392b7f4

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

func ( *InputPhoneContact) () bool {
	if  == nil {
		return true
	}
	if !(.ClientID == 0) {
		return false
	}
	if !(.Phone == "") {
		return false
	}
	if !(.FirstName == "") {
		return false
	}
	if !(.LastName == "") {
		return false
	}

	return true
}

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

// FillFrom fills InputPhoneContact from given interface.
func ( *InputPhoneContact) ( interface {
	() ( int64)
	() ( string)
	() ( string)
	() ( string)
}) {
	.ClientID = .()
	.Phone = .()
	.FirstName = .()
	.LastName = .()
}

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

// TypeName returns name of type in TL schema.
func (*InputPhoneContact) () string {
	return "inputPhoneContact"
}

// TypeInfo returns info about TL type.
func ( *InputPhoneContact) () tdp.Type {
	 := tdp.Type{
		Name: "inputPhoneContact",
		ID:   InputPhoneContactTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ClientID",
			SchemaName: "client_id",
		},
		{
			Name:       "Phone",
			SchemaName: "phone",
		},
		{
			Name:       "FirstName",
			SchemaName: "first_name",
		},
		{
			Name:       "LastName",
			SchemaName: "last_name",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *InputPhoneContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPhoneContact#f392b7f4 as nil")
	}
	.PutID(InputPhoneContactTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputPhoneContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputPhoneContact#f392b7f4 as nil")
	}
	.PutLong(.ClientID)
	.PutString(.Phone)
	.PutString(.FirstName)
	.PutString(.LastName)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputPhoneContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputPhoneContact#f392b7f4 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode inputPhoneContact#f392b7f4: field client_id: %w", )
		}
		.ClientID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputPhoneContact#f392b7f4: field phone: %w", )
		}
		.Phone = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputPhoneContact#f392b7f4: field first_name: %w", )
		}
		.FirstName = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputPhoneContact#f392b7f4: field last_name: %w", )
		}
		.LastName = 
	}
	return nil
}

// GetClientID returns value of ClientID field.
func ( *InputPhoneContact) () ( int64) {
	if  == nil {
		return
	}
	return .ClientID
}

// GetPhone returns value of Phone field.
func ( *InputPhoneContact) () ( string) {
	if  == nil {
		return
	}
	return .Phone
}

// GetFirstName returns value of FirstName field.
func ( *InputPhoneContact) () ( string) {
	if  == nil {
		return
	}
	return .FirstName
}

// GetLastName returns value of LastName field.
func ( *InputPhoneContact) () ( string) {
	if  == nil {
		return
	}
	return .LastName
}