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

// URLAuthResultRequest represents TL type `urlAuthResultRequest#3cd623ec`.
// Details about the authorization request, for more info click here »¹
//
// Links:
//  1. https://core.telegram.org/api/url-authorization
//
// See https://core.telegram.org/constructor/urlAuthResultRequest for reference.
type URLAuthResultRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether the bot would like to send messages to the user
	RequestWriteAccess bool
	// The app/website is requesting the user's phone number; if the user consents, set
	// share_phone_number when calling messages.acceptUrlAuth¹
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.acceptUrlAuth
	RequestPhoneNumber bool
	// Can only be set if match_codes is also set; if set, clients must ask the user to
	// select the matching code before showing the rest of the login confirmation UI, and
	// must validate the selection with messages.checkUrlAuthMatchCode¹ before proceeding
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.checkUrlAuthMatchCode
	MatchCodesFirst bool
	// Set if an OAuth request originated from an app rather than a website; when set, domain
	// must be replaced in the confirmation prompt by verified_app_name (if present) or
	// "Unverified App"
	IsApp bool
	// Username of a bot, which will be used for user authorization. If not specified, the
	// current bot's username will be assumed. The url's domain must be the same as the
	// domain linked with the bot. See Linking your domain to the bot¹ for more details.
	//
	// Links:
	//  1) https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot
	Bot UserClass
	// The domain name of the website on which the user will log in.
	Domain string
	// The browser the user used to make the OAuth request
	//
	// Use SetBrowser and GetBrowser helpers.
	Browser string
	// The platform (operating system) of the user that made the OAuth request
	//
	// Use SetPlatform and GetPlatform helpers.
	Platform string
	// The IP address of the user making the OAuth request
	//
	// Use SetIP and GetIP helpers.
	IP string
	// The location of the user, inferred from the IP address
	//
	// Use SetRegion and GetRegion helpers.
	Region string
	// A list of emojis or codes, one of which is currently being shown on the login page of
	// the website/app; the user must select the matching one and pass it to messages
	// acceptUrlAuth¹.match_code
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.acceptUrlAuth
	//
	// Use SetMatchCodes and GetMatchCodes helpers.
	MatchCodes []string
	// May contain the ID of the account for which the login request was created; if it
	// matches a logged-in account, clients should automatically switch to that account and
	// re-invoke messages.requestUrlAuth¹ before showing the prompt
	//
	// Links:
	//  1) https://core.telegram.org/method/messages.requestUrlAuth
	//
	// Use SetUserIDHint and GetUserIDHint helpers.
	UserIDHint int64
	// Can only be set if is_app is set and the app is verified; must replace domain in the
	// confirmation prompt when present
	//
	// Use SetVerifiedAppName and GetVerifiedAppName helpers.
	VerifiedAppName string
}

// URLAuthResultRequestTypeID is TL type id of URLAuthResultRequest.
const URLAuthResultRequestTypeID = 0x3cd623ec

// construct implements constructor of URLAuthResultClass.
func ( URLAuthResultRequest) () URLAuthResultClass { return & }

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

	_ URLAuthResultClass = &URLAuthResultRequest{}
)

func ( *URLAuthResultRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.RequestWriteAccess == false) {
		return false
	}
	if !(.RequestPhoneNumber == false) {
		return false
	}
	if !(.MatchCodesFirst == false) {
		return false
	}
	if !(.IsApp == false) {
		return false
	}
	if !(.Bot == nil) {
		return false
	}
	if !(.Domain == "") {
		return false
	}
	if !(.Browser == "") {
		return false
	}
	if !(.Platform == "") {
		return false
	}
	if !(.IP == "") {
		return false
	}
	if !(.Region == "") {
		return false
	}
	if !(.MatchCodes == nil) {
		return false
	}
	if !(.UserIDHint == 0) {
		return false
	}
	if !(.VerifiedAppName == "") {
		return false
	}

	return true
}

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

// FillFrom fills URLAuthResultRequest from given interface.
func ( *URLAuthResultRequest) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( UserClass)
	() ( string)
	() ( string,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( string,  bool)
	() ( []string,  bool)
	() ( int64,  bool)
	() ( string,  bool)
}) {
	.RequestWriteAccess = .()
	.RequestPhoneNumber = .()
	.MatchCodesFirst = .()
	.IsApp = .()
	.Bot = .()
	.Domain = .()
	if ,  := .();  {
		.Browser = 
	}

	if ,  := .();  {
		.Platform = 
	}

	if ,  := .();  {
		.IP = 
	}

	if ,  := .();  {
		.Region = 
	}

	if ,  := .();  {
		.MatchCodes = 
	}

	if ,  := .();  {
		.UserIDHint = 
	}

	if ,  := .();  {
		.VerifiedAppName = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *URLAuthResultRequest) () tdp.Type {
	 := tdp.Type{
		Name: "urlAuthResultRequest",
		ID:   URLAuthResultRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "RequestWriteAccess",
			SchemaName: "request_write_access",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "RequestPhoneNumber",
			SchemaName: "request_phone_number",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "MatchCodesFirst",
			SchemaName: "match_codes_first",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "IsApp",
			SchemaName: "is_app",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "Bot",
			SchemaName: "bot",
		},
		{
			Name:       "Domain",
			SchemaName: "domain",
		},
		{
			Name:       "Browser",
			SchemaName: "browser",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Platform",
			SchemaName: "platform",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "IP",
			SchemaName: "ip",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "Region",
			SchemaName: "region",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "MatchCodes",
			SchemaName: "match_codes",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "UserIDHint",
			SchemaName: "user_id_hint",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "VerifiedAppName",
			SchemaName: "verified_app_name",
			Null:       !.Flags.Has(7),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *URLAuthResultRequest) () {
	if !(.RequestWriteAccess == false) {
		.Flags.Set(0)
	}
	if !(.RequestPhoneNumber == false) {
		.Flags.Set(1)
	}
	if !(.MatchCodesFirst == false) {
		.Flags.Set(5)
	}
	if !(.IsApp == false) {
		.Flags.Set(6)
	}
	if !(.Browser == "") {
		.Flags.Set(2)
	}
	if !(.Platform == "") {
		.Flags.Set(2)
	}
	if !(.IP == "") {
		.Flags.Set(2)
	}
	if !(.Region == "") {
		.Flags.Set(2)
	}
	if !(.MatchCodes == nil) {
		.Flags.Set(3)
	}
	if !(.UserIDHint == 0) {
		.Flags.Set(4)
	}
	if !(.VerifiedAppName == "") {
		.Flags.Set(7)
	}
}

// Encode implements bin.Encoder.
func ( *URLAuthResultRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode urlAuthResultRequest#3cd623ec as nil")
	}
	.PutID(URLAuthResultRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *URLAuthResultRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode urlAuthResultRequest#3cd623ec as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode urlAuthResultRequest#3cd623ec: field flags: %w", )
	}
	if .Bot == nil {
		return fmt.Errorf("unable to encode urlAuthResultRequest#3cd623ec: field bot is nil")
	}
	if  := .Bot.Encode();  != nil {
		return fmt.Errorf("unable to encode urlAuthResultRequest#3cd623ec: field bot: %w", )
	}
	.PutString(.Domain)
	if .Flags.Has(2) {
		.PutString(.Browser)
	}
	if .Flags.Has(2) {
		.PutString(.Platform)
	}
	if .Flags.Has(2) {
		.PutString(.IP)
	}
	if .Flags.Has(2) {
		.PutString(.Region)
	}
	if .Flags.Has(3) {
		.PutVectorHeader(len(.MatchCodes))
		for ,  := range .MatchCodes {
			.PutString()
		}
	}
	if .Flags.Has(4) {
		.PutLong(.UserIDHint)
	}
	if .Flags.Has(7) {
		.PutString(.VerifiedAppName)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *URLAuthResultRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode urlAuthResultRequest#3cd623ec to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field flags: %w", )
		}
	}
	.RequestWriteAccess = .Flags.Has(0)
	.RequestPhoneNumber = .Flags.Has(1)
	.MatchCodesFirst = .Flags.Has(5)
	.IsApp = .Flags.Has(6)
	{
		,  := DecodeUser()
		if  != nil {
			return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field bot: %w", )
		}
		.Bot = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field domain: %w", )
		}
		.Domain = 
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field browser: %w", )
		}
		.Browser = 
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field platform: %w", )
		}
		.Platform = 
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field ip: %w", )
		}
		.IP = 
	}
	if .Flags.Has(2) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field region: %w", )
		}
		.Region = 
	}
	if .Flags.Has(3) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field match_codes: %w", )
		}

		if  > 0 {
			.MatchCodes = make([]string, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .String()
			if  != nil {
				return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field match_codes: %w", )
			}
			.MatchCodes = append(.MatchCodes, )
		}
	}
	if .Flags.Has(4) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field user_id_hint: %w", )
		}
		.UserIDHint = 
	}
	if .Flags.Has(7) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode urlAuthResultRequest#3cd623ec: field verified_app_name: %w", )
		}
		.VerifiedAppName = 
	}
	return nil
}

// SetRequestWriteAccess sets value of RequestWriteAccess conditional field.
func ( *URLAuthResultRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.RequestWriteAccess = true
	} else {
		.Flags.Unset(0)
		.RequestWriteAccess = false
	}
}

// GetRequestWriteAccess returns value of RequestWriteAccess conditional field.
func ( *URLAuthResultRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetRequestPhoneNumber sets value of RequestPhoneNumber conditional field.
func ( *URLAuthResultRequest) ( bool) {
	if  {
		.Flags.Set(1)
		.RequestPhoneNumber = true
	} else {
		.Flags.Unset(1)
		.RequestPhoneNumber = false
	}
}

// GetRequestPhoneNumber returns value of RequestPhoneNumber conditional field.
func ( *URLAuthResultRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetMatchCodesFirst sets value of MatchCodesFirst conditional field.
func ( *URLAuthResultRequest) ( bool) {
	if  {
		.Flags.Set(5)
		.MatchCodesFirst = true
	} else {
		.Flags.Unset(5)
		.MatchCodesFirst = false
	}
}

// GetMatchCodesFirst returns value of MatchCodesFirst conditional field.
func ( *URLAuthResultRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(5)
}

// SetIsApp sets value of IsApp conditional field.
func ( *URLAuthResultRequest) ( bool) {
	if  {
		.Flags.Set(6)
		.IsApp = true
	} else {
		.Flags.Unset(6)
		.IsApp = false
	}
}

// GetIsApp returns value of IsApp conditional field.
func ( *URLAuthResultRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(6)
}

// GetBot returns value of Bot field.
func ( *URLAuthResultRequest) () ( UserClass) {
	if  == nil {
		return
	}
	return .Bot
}

// GetDomain returns value of Domain field.
func ( *URLAuthResultRequest) () ( string) {
	if  == nil {
		return
	}
	return .Domain
}

// SetBrowser sets value of Browser conditional field.
func ( *URLAuthResultRequest) ( string) {
	.Flags.Set(2)
	.Browser = 
}

// GetBrowser returns value of Browser conditional field and
// boolean which is true if field was set.
func ( *URLAuthResultRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .Browser, true
}

// SetPlatform sets value of Platform conditional field.
func ( *URLAuthResultRequest) ( string) {
	.Flags.Set(2)
	.Platform = 
}

// GetPlatform returns value of Platform conditional field and
// boolean which is true if field was set.
func ( *URLAuthResultRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .Platform, true
}

// SetIP sets value of IP conditional field.
func ( *URLAuthResultRequest) ( string) {
	.Flags.Set(2)
	.IP = 
}

// GetIP returns value of IP conditional field and
// boolean which is true if field was set.
func ( *URLAuthResultRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .IP, true
}

// SetRegion sets value of Region conditional field.
func ( *URLAuthResultRequest) ( string) {
	.Flags.Set(2)
	.Region = 
}

// GetRegion returns value of Region conditional field and
// boolean which is true if field was set.
func ( *URLAuthResultRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .Region, true
}

// SetMatchCodes sets value of MatchCodes conditional field.
func ( *URLAuthResultRequest) ( []string) {
	.Flags.Set(3)
	.MatchCodes = 
}

// GetMatchCodes returns value of MatchCodes conditional field and
// boolean which is true if field was set.
func ( *URLAuthResultRequest) () ( []string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .MatchCodes, true
}

// SetUserIDHint sets value of UserIDHint conditional field.
func ( *URLAuthResultRequest) ( int64) {
	.Flags.Set(4)
	.UserIDHint = 
}

// GetUserIDHint returns value of UserIDHint conditional field and
// boolean which is true if field was set.
func ( *URLAuthResultRequest) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(4) {
		return , false
	}
	return .UserIDHint, true
}

// SetVerifiedAppName sets value of VerifiedAppName conditional field.
func ( *URLAuthResultRequest) ( string) {
	.Flags.Set(7)
	.VerifiedAppName = 
}

// GetVerifiedAppName returns value of VerifiedAppName conditional field and
// boolean which is true if field was set.
func ( *URLAuthResultRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(7) {
		return , false
	}
	return .VerifiedAppName, true
}

// URLAuthResultAccepted represents TL type `urlAuthResultAccepted#623a8fa0`.
// Details about an accepted authorization request, for more info click here »¹
//
// Links:
//  1. https://core.telegram.org/api/url-authorization
//
// See https://core.telegram.org/constructor/urlAuthResultAccepted for reference.
type URLAuthResultAccepted struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If present, the URL to open in the external browser (may use a custom scheme for
	// direct switching to another app); if absent, the login succeeded and clients should
	// simply show a confirmation toast. Always set for bot button URL authorization¹ and
	// link URL authorization².
	//
	// Links:
	//  1) https://core.telegram.org/api/url-authorization#bot-button-url-authorization
	//  2) https://core.telegram.org/api/url-authorization#link-url-authorization
	//
	// Use SetURL and GetURL helpers.
	URL string
}

// URLAuthResultAcceptedTypeID is TL type id of URLAuthResultAccepted.
const URLAuthResultAcceptedTypeID = 0x623a8fa0

// construct implements constructor of URLAuthResultClass.
func ( URLAuthResultAccepted) () URLAuthResultClass { return & }

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

	_ URLAuthResultClass = &URLAuthResultAccepted{}
)

func ( *URLAuthResultAccepted) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.URL == "") {
		return false
	}

	return true
}

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

// FillFrom fills URLAuthResultAccepted from given interface.
func ( *URLAuthResultAccepted) ( interface {
	() ( string,  bool)
}) {
	if ,  := .();  {
		.URL = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *URLAuthResultAccepted) () tdp.Type {
	 := tdp.Type{
		Name: "urlAuthResultAccepted",
		ID:   URLAuthResultAcceptedTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "URL",
			SchemaName: "url",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *URLAuthResultAccepted) () {
	if !(.URL == "") {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *URLAuthResultAccepted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode urlAuthResultAccepted#623a8fa0 as nil")
	}
	.PutID(URLAuthResultAcceptedTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *URLAuthResultAccepted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode urlAuthResultAccepted#623a8fa0 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode urlAuthResultAccepted#623a8fa0: field flags: %w", )
	}
	if .Flags.Has(0) {
		.PutString(.URL)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *URLAuthResultAccepted) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode urlAuthResultAccepted#623a8fa0 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode urlAuthResultAccepted#623a8fa0: field flags: %w", )
		}
	}
	if .Flags.Has(0) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode urlAuthResultAccepted#623a8fa0: field url: %w", )
		}
		.URL = 
	}
	return nil
}

// SetURL sets value of URL conditional field.
func ( *URLAuthResultAccepted) ( string) {
	.Flags.Set(0)
	.URL = 
}

// GetURL returns value of URL conditional field and
// boolean which is true if field was set.
func ( *URLAuthResultAccepted) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .URL, true
}

// URLAuthResultDefault represents TL type `urlAuthResultDefault#a9d6db1f`.
// Details about an accepted authorization request, for more info click here »¹
//
// Links:
//  1. https://core.telegram.org/api/url-authorization
//
// See https://core.telegram.org/constructor/urlAuthResultDefault for reference.
type URLAuthResultDefault struct {
}

// URLAuthResultDefaultTypeID is TL type id of URLAuthResultDefault.
const URLAuthResultDefaultTypeID = 0xa9d6db1f

// construct implements constructor of URLAuthResultClass.
func ( URLAuthResultDefault) () URLAuthResultClass { return & }

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

	_ URLAuthResultClass = &URLAuthResultDefault{}
)

func ( *URLAuthResultDefault) () bool {
	if  == nil {
		return true
	}

	return true
}

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

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

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

// TypeInfo returns info about TL type.
func ( *URLAuthResultDefault) () tdp.Type {
	 := tdp.Type{
		Name: "urlAuthResultDefault",
		ID:   URLAuthResultDefaultTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{}
	return 
}

// Encode implements bin.Encoder.
func ( *URLAuthResultDefault) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode urlAuthResultDefault#a9d6db1f as nil")
	}
	.PutID(URLAuthResultDefaultTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *URLAuthResultDefault) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode urlAuthResultDefault#a9d6db1f as nil")
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *URLAuthResultDefault) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode urlAuthResultDefault#a9d6db1f to nil")
	}
	return nil
}

// URLAuthResultClassName is schema name of URLAuthResultClass.
const URLAuthResultClassName = "UrlAuthResult"

// URLAuthResultClass represents UrlAuthResult generic type.
//
// See https://core.telegram.org/type/UrlAuthResult for reference.
//
// Constructors:
//   - [URLAuthResultRequest]
//   - [URLAuthResultAccepted]
//   - [URLAuthResultDefault]
//
// Example:
//
//	g, err := tg.DecodeURLAuthResult(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.URLAuthResultRequest: // urlAuthResultRequest#3cd623ec
//	case *tg.URLAuthResultAccepted: // urlAuthResultAccepted#623a8fa0
//	case *tg.URLAuthResultDefault: // urlAuthResultDefault#a9d6db1f
//	default: panic(v)
//	}
type URLAuthResultClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() URLAuthResultClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool
}

// DecodeURLAuthResult implements binary de-serialization for URLAuthResultClass.
func ( *bin.Buffer) (URLAuthResultClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case URLAuthResultRequestTypeID:
		// Decoding urlAuthResultRequest#3cd623ec.
		 := URLAuthResultRequest{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode URLAuthResultClass: %w", )
		}
		return &, nil
	case URLAuthResultAcceptedTypeID:
		// Decoding urlAuthResultAccepted#623a8fa0.
		 := URLAuthResultAccepted{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode URLAuthResultClass: %w", )
		}
		return &, nil
	case URLAuthResultDefaultTypeID:
		// Decoding urlAuthResultDefault#a9d6db1f.
		 := URLAuthResultDefault{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode URLAuthResultClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode URLAuthResultClass: %w", bin.NewUnexpectedID())
	}
}

// URLAuthResult boxes the URLAuthResultClass providing a helper.
type URLAuthResultBox struct {
	UrlAuthResult URLAuthResultClass
}

// Decode implements bin.Decoder for URLAuthResultBox.
func ( *URLAuthResultBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode URLAuthResultBox to nil")
	}
	,  := DecodeURLAuthResult()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.UrlAuthResult = 
	return nil
}

// Encode implements bin.Encode for URLAuthResultBox.
func ( *URLAuthResultBox) ( *bin.Buffer) error {
	if  == nil || .UrlAuthResult == nil {
		return fmt.Errorf("unable to encode URLAuthResultClass as nil")
	}
	return .UrlAuthResult.Encode()
}