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

// BusinessBotRights represents TL type `businessBotRights#a0624cf7`.
// Business bot rights¹.
//
// Links:
//  1. https://core.telegram.org/api/bots/connected-business-bots
//
// See https://core.telegram.org/constructor/businessBotRights for reference.
type BusinessBotRights struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Whether the bot can send and edit messages in private chats that had incoming messages
	// in the last 24 hours.
	Reply bool
	// Whether the bot can mark incoming private messages as read.
	ReadMessages bool
	// Whether the bot can delete messages sent by the bot.
	DeleteSentMessages bool
	// Whether the bot can delete received private messages in managed chats.
	DeleteReceivedMessages bool
	// Whether the bot can edit the first and last name of the business account.
	EditName bool
	// Whether the bot can edit the bio of the business account.
	EditBio bool
	// Whether the bot can edit the profile photo of the business account.
	EditProfilePhoto bool
	// Whether the bot can edit the username of the business account.
	EditUsername bool
	// Whether the bot can view gifts and the amount of Telegram Stars owned by the business
	// account.
	ViewGifts bool
	// Whether the bot can convert regular gifts owned by the business account to Telegram
	// Stars.
	SellGifts bool
	// Whether the bot can change the privacy settings pertaining to gifts for the business
	// account.
	ChangeGiftSettings bool
	// Whether the bot can transfer and upgrade gifts owned by the business account.
	TransferAndUpgradeGifts bool
	// Whether the bot can transfer Telegram Stars received by the business account to its
	// own account, or use them to upgrade and transfer gifts.
	TransferStars bool
	// Whether the bot can post, edit and delete stories on behalf of the business account.
	ManageStories bool
}

// BusinessBotRightsTypeID is TL type id of BusinessBotRights.
const BusinessBotRightsTypeID = 0xa0624cf7

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

func ( *BusinessBotRights) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.Reply == false) {
		return false
	}
	if !(.ReadMessages == false) {
		return false
	}
	if !(.DeleteSentMessages == false) {
		return false
	}
	if !(.DeleteReceivedMessages == false) {
		return false
	}
	if !(.EditName == false) {
		return false
	}
	if !(.EditBio == false) {
		return false
	}
	if !(.EditProfilePhoto == false) {
		return false
	}
	if !(.EditUsername == false) {
		return false
	}
	if !(.ViewGifts == false) {
		return false
	}
	if !(.SellGifts == false) {
		return false
	}
	if !(.ChangeGiftSettings == false) {
		return false
	}
	if !(.TransferAndUpgradeGifts == false) {
		return false
	}
	if !(.TransferStars == false) {
		return false
	}
	if !(.ManageStories == false) {
		return false
	}

	return true
}

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

// FillFrom fills BusinessBotRights from given interface.
func ( *BusinessBotRights) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
}) {
	.Reply = .()
	.ReadMessages = .()
	.DeleteSentMessages = .()
	.DeleteReceivedMessages = .()
	.EditName = .()
	.EditBio = .()
	.EditProfilePhoto = .()
	.EditUsername = .()
	.ViewGifts = .()
	.SellGifts = .()
	.ChangeGiftSettings = .()
	.TransferAndUpgradeGifts = .()
	.TransferStars = .()
	.ManageStories = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *BusinessBotRights) () tdp.Type {
	 := tdp.Type{
		Name: "businessBotRights",
		ID:   BusinessBotRightsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Reply",
			SchemaName: "reply",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "ReadMessages",
			SchemaName: "read_messages",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "DeleteSentMessages",
			SchemaName: "delete_sent_messages",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "DeleteReceivedMessages",
			SchemaName: "delete_received_messages",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "EditName",
			SchemaName: "edit_name",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "EditBio",
			SchemaName: "edit_bio",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "EditProfilePhoto",
			SchemaName: "edit_profile_photo",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "EditUsername",
			SchemaName: "edit_username",
			Null:       !.Flags.Has(7),
		},
		{
			Name:       "ViewGifts",
			SchemaName: "view_gifts",
			Null:       !.Flags.Has(8),
		},
		{
			Name:       "SellGifts",
			SchemaName: "sell_gifts",
			Null:       !.Flags.Has(9),
		},
		{
			Name:       "ChangeGiftSettings",
			SchemaName: "change_gift_settings",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "TransferAndUpgradeGifts",
			SchemaName: "transfer_and_upgrade_gifts",
			Null:       !.Flags.Has(11),
		},
		{
			Name:       "TransferStars",
			SchemaName: "transfer_stars",
			Null:       !.Flags.Has(12),
		},
		{
			Name:       "ManageStories",
			SchemaName: "manage_stories",
			Null:       !.Flags.Has(13),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *BusinessBotRights) () {
	if !(.Reply == false) {
		.Flags.Set(0)
	}
	if !(.ReadMessages == false) {
		.Flags.Set(1)
	}
	if !(.DeleteSentMessages == false) {
		.Flags.Set(2)
	}
	if !(.DeleteReceivedMessages == false) {
		.Flags.Set(3)
	}
	if !(.EditName == false) {
		.Flags.Set(4)
	}
	if !(.EditBio == false) {
		.Flags.Set(5)
	}
	if !(.EditProfilePhoto == false) {
		.Flags.Set(6)
	}
	if !(.EditUsername == false) {
		.Flags.Set(7)
	}
	if !(.ViewGifts == false) {
		.Flags.Set(8)
	}
	if !(.SellGifts == false) {
		.Flags.Set(9)
	}
	if !(.ChangeGiftSettings == false) {
		.Flags.Set(10)
	}
	if !(.TransferAndUpgradeGifts == false) {
		.Flags.Set(11)
	}
	if !(.TransferStars == false) {
		.Flags.Set(12)
	}
	if !(.ManageStories == false) {
		.Flags.Set(13)
	}
}

// Encode implements bin.Encoder.
func ( *BusinessBotRights) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode businessBotRights#a0624cf7 as nil")
	}
	.PutID(BusinessBotRightsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BusinessBotRights) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode businessBotRights#a0624cf7 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode businessBotRights#a0624cf7: field flags: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BusinessBotRights) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode businessBotRights#a0624cf7 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode businessBotRights#a0624cf7: field flags: %w", )
		}
	}
	.Reply = .Flags.Has(0)
	.ReadMessages = .Flags.Has(1)
	.DeleteSentMessages = .Flags.Has(2)
	.DeleteReceivedMessages = .Flags.Has(3)
	.EditName = .Flags.Has(4)
	.EditBio = .Flags.Has(5)
	.EditProfilePhoto = .Flags.Has(6)
	.EditUsername = .Flags.Has(7)
	.ViewGifts = .Flags.Has(8)
	.SellGifts = .Flags.Has(9)
	.ChangeGiftSettings = .Flags.Has(10)
	.TransferAndUpgradeGifts = .Flags.Has(11)
	.TransferStars = .Flags.Has(12)
	.ManageStories = .Flags.Has(13)
	return nil
}

// SetReply sets value of Reply conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(0)
		.Reply = true
	} else {
		.Flags.Unset(0)
		.Reply = false
	}
}

// GetReply returns value of Reply conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetReadMessages sets value of ReadMessages conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(1)
		.ReadMessages = true
	} else {
		.Flags.Unset(1)
		.ReadMessages = false
	}
}

// GetReadMessages returns value of ReadMessages conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(1)
}

// SetDeleteSentMessages sets value of DeleteSentMessages conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(2)
		.DeleteSentMessages = true
	} else {
		.Flags.Unset(2)
		.DeleteSentMessages = false
	}
}

// GetDeleteSentMessages returns value of DeleteSentMessages conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(2)
}

// SetDeleteReceivedMessages sets value of DeleteReceivedMessages conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(3)
		.DeleteReceivedMessages = true
	} else {
		.Flags.Unset(3)
		.DeleteReceivedMessages = false
	}
}

// GetDeleteReceivedMessages returns value of DeleteReceivedMessages conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(3)
}

// SetEditName sets value of EditName conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(4)
		.EditName = true
	} else {
		.Flags.Unset(4)
		.EditName = false
	}
}

// GetEditName returns value of EditName conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(4)
}

// SetEditBio sets value of EditBio conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(5)
		.EditBio = true
	} else {
		.Flags.Unset(5)
		.EditBio = false
	}
}

// GetEditBio returns value of EditBio conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(5)
}

// SetEditProfilePhoto sets value of EditProfilePhoto conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(6)
		.EditProfilePhoto = true
	} else {
		.Flags.Unset(6)
		.EditProfilePhoto = false
	}
}

// GetEditProfilePhoto returns value of EditProfilePhoto conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(6)
}

// SetEditUsername sets value of EditUsername conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(7)
		.EditUsername = true
	} else {
		.Flags.Unset(7)
		.EditUsername = false
	}
}

// GetEditUsername returns value of EditUsername conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(7)
}

// SetViewGifts sets value of ViewGifts conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(8)
		.ViewGifts = true
	} else {
		.Flags.Unset(8)
		.ViewGifts = false
	}
}

// GetViewGifts returns value of ViewGifts conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(8)
}

// SetSellGifts sets value of SellGifts conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(9)
		.SellGifts = true
	} else {
		.Flags.Unset(9)
		.SellGifts = false
	}
}

// GetSellGifts returns value of SellGifts conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(9)
}

// SetChangeGiftSettings sets value of ChangeGiftSettings conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(10)
		.ChangeGiftSettings = true
	} else {
		.Flags.Unset(10)
		.ChangeGiftSettings = false
	}
}

// GetChangeGiftSettings returns value of ChangeGiftSettings conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(10)
}

// SetTransferAndUpgradeGifts sets value of TransferAndUpgradeGifts conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(11)
		.TransferAndUpgradeGifts = true
	} else {
		.Flags.Unset(11)
		.TransferAndUpgradeGifts = false
	}
}

// GetTransferAndUpgradeGifts returns value of TransferAndUpgradeGifts conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(11)
}

// SetTransferStars sets value of TransferStars conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(12)
		.TransferStars = true
	} else {
		.Flags.Unset(12)
		.TransferStars = false
	}
}

// GetTransferStars returns value of TransferStars conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(12)
}

// SetManageStories sets value of ManageStories conditional field.
func ( *BusinessBotRights) ( bool) {
	if  {
		.Flags.Set(13)
		.ManageStories = true
	} else {
		.Flags.Unset(13)
		.ManageStories = false
	}
}

// GetManageStories returns value of ManageStories conditional field.
func ( *BusinessBotRights) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(13)
}