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

// BotVerifierSettings represents TL type `botVerifierSettings#b0cd6617`.
// Info about the current verifier bot »¹.
//
// Links:
//  1. https://core.telegram.org/api/bots/verification
//
// See https://core.telegram.org/constructor/botVerifierSettings for reference.
type BotVerifierSettings struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Indicates whether the bot is allowed to set a custom description field for individual
	// verified peers, different from the custom_description provided here.
	CanModifyCustomDescription bool
	// Verification icon
	Icon int64
	// The name of the organization that provides the verification
	Company string
	// An optional default description for the verification
	//
	// Use SetCustomDescription and GetCustomDescription helpers.
	CustomDescription string
}

// BotVerifierSettingsTypeID is TL type id of BotVerifierSettings.
const BotVerifierSettingsTypeID = 0xb0cd6617

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

func ( *BotVerifierSettings) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.CanModifyCustomDescription == false) {
		return false
	}
	if !(.Icon == 0) {
		return false
	}
	if !(.Company == "") {
		return false
	}
	if !(.CustomDescription == "") {
		return false
	}

	return true
}

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

// FillFrom fills BotVerifierSettings from given interface.
func ( *BotVerifierSettings) ( interface {
	() ( bool)
	() ( int64)
	() ( string)
	() ( string,  bool)
}) {
	.CanModifyCustomDescription = .()
	.Icon = .()
	.Company = .()
	if ,  := .();  {
		.CustomDescription = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *BotVerifierSettings) () tdp.Type {
	 := tdp.Type{
		Name: "botVerifierSettings",
		ID:   BotVerifierSettingsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "CanModifyCustomDescription",
			SchemaName: "can_modify_custom_description",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Icon",
			SchemaName: "icon",
		},
		{
			Name:       "Company",
			SchemaName: "company",
		},
		{
			Name:       "CustomDescription",
			SchemaName: "custom_description",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *BotVerifierSettings) () {
	if !(.CanModifyCustomDescription == false) {
		.Flags.Set(1)
	}
	if !(.CustomDescription == "") {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *BotVerifierSettings) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botVerifierSettings#b0cd6617 as nil")
	}
	.PutID(BotVerifierSettingsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BotVerifierSettings) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode botVerifierSettings#b0cd6617 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode botVerifierSettings#b0cd6617: field flags: %w", )
	}
	.PutLong(.Icon)
	.PutString(.Company)
	if .Flags.Has(0) {
		.PutString(.CustomDescription)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BotVerifierSettings) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode botVerifierSettings#b0cd6617 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode botVerifierSettings#b0cd6617: field flags: %w", )
		}
	}
	.CanModifyCustomDescription = .Flags.Has(1)
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode botVerifierSettings#b0cd6617: field icon: %w", )
		}
		.Icon = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botVerifierSettings#b0cd6617: field company: %w", )
		}
		.Company = 
	}
	if .Flags.Has(0) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode botVerifierSettings#b0cd6617: field custom_description: %w", )
		}
		.CustomDescription = 
	}
	return nil
}

// SetCanModifyCustomDescription sets value of CanModifyCustomDescription conditional field.
func ( *BotVerifierSettings) ( bool) {
	if  {
		.Flags.Set(1)
		.CanModifyCustomDescription = true
	} else {
		.Flags.Unset(1)
		.CanModifyCustomDescription = false
	}
}

// GetCanModifyCustomDescription returns value of CanModifyCustomDescription conditional field.
func ( *BotVerifierSettings) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// GetIcon returns value of Icon field.
func ( *BotVerifierSettings) () ( int64) {
	if  == nil {
		return
	}
	return .Icon
}

// GetCompany returns value of Company field.
func ( *BotVerifierSettings) () ( string) {
	if  == nil {
		return
	}
	return .Company
}

// SetCustomDescription sets value of CustomDescription conditional field.
func ( *BotVerifierSettings) ( string) {
	.Flags.Set(0)
	.CustomDescription = 
}

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