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

// InputBusinessIntro represents TL type `inputBusinessIntro#9c469cd`.
// Telegram Business introduction »¹.
//
// Links:
//  1. https://core.telegram.org/api/business#business-introduction
//
// See https://core.telegram.org/constructor/inputBusinessIntro for reference.
type InputBusinessIntro struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Title of the introduction message
	Title string
	// Profile introduction
	Description string
	// Optional introduction sticker¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/stickers
	//
	// Use SetSticker and GetSticker helpers.
	Sticker InputDocumentClass
}

// InputBusinessIntroTypeID is TL type id of InputBusinessIntro.
const InputBusinessIntroTypeID = 0x9c469cd

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

func ( *InputBusinessIntro) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Title == "") {
		return false
	}
	if !(.Description == "") {
		return false
	}
	if !(.Sticker == nil) {
		return false
	}

	return true
}

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

// FillFrom fills InputBusinessIntro from given interface.
func ( *InputBusinessIntro) ( interface {
	() ( string)
	() ( string)
	() ( InputDocumentClass,  bool)
}) {
	.Title = .()
	.Description = .()
	if ,  := .();  {
		.Sticker = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *InputBusinessIntro) () tdp.Type {
	 := tdp.Type{
		Name: "inputBusinessIntro",
		ID:   InputBusinessIntroTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Title",
			SchemaName: "title",
		},
		{
			Name:       "Description",
			SchemaName: "description",
		},
		{
			Name:       "Sticker",
			SchemaName: "sticker",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

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

// Encode implements bin.Encoder.
func ( *InputBusinessIntro) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputBusinessIntro#9c469cd as nil")
	}
	.PutID(InputBusinessIntroTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *InputBusinessIntro) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode inputBusinessIntro#9c469cd as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode inputBusinessIntro#9c469cd: field flags: %w", )
	}
	.PutString(.Title)
	.PutString(.Description)
	if .Flags.Has(0) {
		if .Sticker == nil {
			return fmt.Errorf("unable to encode inputBusinessIntro#9c469cd: field sticker is nil")
		}
		if  := .Sticker.Encode();  != nil {
			return fmt.Errorf("unable to encode inputBusinessIntro#9c469cd: field sticker: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *InputBusinessIntro) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode inputBusinessIntro#9c469cd to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode inputBusinessIntro#9c469cd: field flags: %w", )
		}
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputBusinessIntro#9c469cd: field title: %w", )
		}
		.Title = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode inputBusinessIntro#9c469cd: field description: %w", )
		}
		.Description = 
	}
	if .Flags.Has(0) {
		,  := DecodeInputDocument()
		if  != nil {
			return fmt.Errorf("unable to decode inputBusinessIntro#9c469cd: field sticker: %w", )
		}
		.Sticker = 
	}
	return nil
}

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

// GetDescription returns value of Description field.
func ( *InputBusinessIntro) () ( string) {
	if  == nil {
		return
	}
	return .Description
}

// SetSticker sets value of Sticker conditional field.
func ( *InputBusinessIntro) ( InputDocumentClass) {
	.Flags.Set(0)
	.Sticker = 
}

// GetSticker returns value of Sticker conditional field and
// boolean which is true if field was set.
func ( *InputBusinessIntro) () ( InputDocumentClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Sticker, true
}

// GetStickerAsNotEmpty returns mapped value of Sticker conditional field and
// boolean which is true if field was set.
func ( *InputBusinessIntro) () (*InputDocument, bool) {
	if ,  := .GetSticker();  {
		return .AsNotEmpty()
	}
	return nil, false
}