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

// WebDomainException represents TL type `webDomainException#933ca597`.
//
// See https://core.telegram.org/constructor/webDomainException for reference.
type WebDomainException struct {
	// Flags field of WebDomainException.
	Flags bin.Fields
	// Domain field of WebDomainException.
	Domain string
	// URL field of WebDomainException.
	URL string
	// Title field of WebDomainException.
	Title string
	// Favicon field of WebDomainException.
	//
	// Use SetFavicon and GetFavicon helpers.
	Favicon int64
}

// WebDomainExceptionTypeID is TL type id of WebDomainException.
const WebDomainExceptionTypeID = 0x933ca597

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

func ( *WebDomainException) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Domain == "") {
		return false
	}
	if !(.URL == "") {
		return false
	}
	if !(.Title == "") {
		return false
	}
	if !(.Favicon == 0) {
		return false
	}

	return true
}

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

// FillFrom fills WebDomainException from given interface.
func ( *WebDomainException) ( interface {
	() ( string)
	() ( string)
	() ( string)
	() ( int64,  bool)
}) {
	.Domain = .()
	.URL = .()
	.Title = .()
	if ,  := .();  {
		.Favicon = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *WebDomainException) () tdp.Type {
	 := tdp.Type{
		Name: "webDomainException",
		ID:   WebDomainExceptionTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Domain",
			SchemaName: "domain",
		},
		{
			Name:       "URL",
			SchemaName: "url",
		},
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Favicon",
			SchemaName: "favicon",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

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

// Encode implements bin.Encoder.
func ( *WebDomainException) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode webDomainException#933ca597 as nil")
	}
	.PutID(WebDomainExceptionTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *WebDomainException) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode webDomainException#933ca597 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode webDomainException#933ca597: field flags: %w", )
	}
	.PutString(.Domain)
	.PutString(.URL)
	.PutString(.Title)
	if .Flags.Has(0) {
		.PutLong(.Favicon)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *WebDomainException) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode webDomainException#933ca597 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode webDomainException#933ca597: field flags: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode webDomainException#933ca597: field domain: %w", )
		}
		.Domain = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode webDomainException#933ca597: field url: %w", )
		}
		.URL = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode webDomainException#933ca597: field title: %w", )
		}
		.Title = 
	}
	if .Flags.Has(0) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode webDomainException#933ca597: field favicon: %w", )
		}
		.Favicon = 
	}
	return nil
}

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

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

// GetTitle returns value of Title field.
func ( *WebDomainException) () ( string) {
	if  == nil {
		return
	}
	return .Title
}

// SetFavicon sets value of Favicon conditional field.
func ( *WebDomainException) ( int64) {
	.Flags.Set(0)
	.Favicon = 
}

// GetFavicon returns value of Favicon conditional field and
// boolean which is true if field was set.
func ( *WebDomainException) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Favicon, true
}