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

// ExportedContactToken represents TL type `exportedContactToken#41bf109b`.
// Describes a temporary profile linkĀ¹.
//
// Links:
//  1. https://core.telegram.org/api/links#temporary-profile-links
//
// See https://core.telegram.org/constructor/exportedContactToken for reference.
type ExportedContactToken struct {
	// The temporary profile linkĀ¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/links#temporary-profile-links
	URL string
	// Its expiration date
	Expires int
}

// ExportedContactTokenTypeID is TL type id of ExportedContactToken.
const ExportedContactTokenTypeID = 0x41bf109b

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

func ( *ExportedContactToken) () bool {
	if  == nil {
		return true
	}
	if !(.URL == "") {
		return false
	}
	if !(.Expires == 0) {
		return false
	}

	return true
}

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

// FillFrom fills ExportedContactToken from given interface.
func ( *ExportedContactToken) ( interface {
	() ( string)
	() ( int)
}) {
	.URL = .()
	.Expires = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ExportedContactToken) () tdp.Type {
	 := tdp.Type{
		Name: "exportedContactToken",
		ID:   ExportedContactTokenTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "Expires",
			SchemaName: "expires",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ExportedContactToken) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode exportedContactToken#41bf109b as nil")
	}
	.PutID(ExportedContactTokenTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ExportedContactToken) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode exportedContactToken#41bf109b as nil")
	}
	.PutString(.URL)
	.PutInt(.Expires)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ExportedContactToken) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode exportedContactToken#41bf109b to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode exportedContactToken#41bf109b: field url: %w", )
		}
		.URL = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode exportedContactToken#41bf109b: field expires: %w", )
		}
		.Expires = 
	}
	return nil
}

// GetURL returns value of URL field.
func ( *ExportedContactToken) () ( string) {
	if  == nil {
		return
	}
	return .URL
}

// GetExpires returns value of Expires field.
func ( *ExportedContactToken) () ( int) {
	if  == nil {
		return
	}
	return .Expires
}