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

// ContactsResolvePhoneRequest represents TL type `contacts.resolvePhone#8af94344`.
// Resolve a phone number to get user info, if their privacy settings allow it.
//
// See https://core.telegram.org/method/contacts.resolvePhone for reference.
type ContactsResolvePhoneRequest struct {
	// Phone number in international format, possibly obtained from a phone number deep
	// linkĀ¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/links#phone-number-links
	Phone string
}

// ContactsResolvePhoneRequestTypeID is TL type id of ContactsResolvePhoneRequest.
const ContactsResolvePhoneRequestTypeID = 0x8af94344

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

func ( *ContactsResolvePhoneRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Phone == "") {
		return false
	}

	return true
}

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

// FillFrom fills ContactsResolvePhoneRequest from given interface.
func ( *ContactsResolvePhoneRequest) ( interface {
	() ( string)
}) {
	.Phone = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ContactsResolvePhoneRequest) () tdp.Type {
	 := tdp.Type{
		Name: "contacts.resolvePhone",
		ID:   ContactsResolvePhoneRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Phone",
			SchemaName: "phone",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ContactsResolvePhoneRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contacts.resolvePhone#8af94344 as nil")
	}
	.PutID(ContactsResolvePhoneRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ContactsResolvePhoneRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contacts.resolvePhone#8af94344 as nil")
	}
	.PutString(.Phone)
	return nil
}

// Decode implements bin.Decoder.
func ( *ContactsResolvePhoneRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode contacts.resolvePhone#8af94344 to nil")
	}
	if  := .ConsumeID(ContactsResolvePhoneRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode contacts.resolvePhone#8af94344: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *ContactsResolvePhoneRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode contacts.resolvePhone#8af94344 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode contacts.resolvePhone#8af94344: field phone: %w", )
		}
		.Phone = 
	}
	return nil
}

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

// ContactsResolvePhone invokes method contacts.resolvePhone#8af94344 returning error if any.
// Resolve a phone number to get user info, if their privacy settings allow it.
//
// Possible errors:
//
//	400 PHONE_NOT_OCCUPIED: No user is associated to the specified phone number.
//
// See https://core.telegram.org/method/contacts.resolvePhone for reference.
func ( *Client) ( context.Context,  string) (*ContactsResolvedPeer, error) {
	var  ContactsResolvedPeer

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