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

// ImportedContact represents TL type `importedContact#c13e3c50`.
// Successfully imported contact.
//
// See https://core.telegram.org/constructor/importedContact for reference.
type ImportedContact struct {
	// User identifier
	UserID int64
	// The contact's client identifier (passed to one of the InputContact¹ constructors)
	//
	// Links:
	//  1) https://core.telegram.org/type/InputContact
	ClientID int64
}

// ImportedContactTypeID is TL type id of ImportedContact.
const ImportedContactTypeID = 0xc13e3c50

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

func ( *ImportedContact) () bool {
	if  == nil {
		return true
	}
	if !(.UserID == 0) {
		return false
	}
	if !(.ClientID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills ImportedContact from given interface.
func ( *ImportedContact) ( interface {
	() ( int64)
	() ( int64)
}) {
	.UserID = .()
	.ClientID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ImportedContact) () tdp.Type {
	 := tdp.Type{
		Name: "importedContact",
		ID:   ImportedContactTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "UserID",
			SchemaName: "user_id",
		},
		{
			Name:       "ClientID",
			SchemaName: "client_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ImportedContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode importedContact#c13e3c50 as nil")
	}
	.PutID(ImportedContactTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ImportedContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode importedContact#c13e3c50 as nil")
	}
	.PutLong(.UserID)
	.PutLong(.ClientID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ImportedContact) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode importedContact#c13e3c50 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode importedContact#c13e3c50: field user_id: %w", )
		}
		.UserID = 
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode importedContact#c13e3c50: field client_id: %w", )
		}
		.ClientID = 
	}
	return nil
}

// GetUserID returns value of UserID field.
func ( *ImportedContact) () ( int64) {
	if  == nil {
		return
	}
	return .UserID
}

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