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

// SavedStarGift represents TL type `savedStarGift#41df43fc`.
// Represents a gift¹ owned by a peer.
//
// Links:
//  1. https://core.telegram.org/api/gifts
//
// See https://core.telegram.org/constructor/savedStarGift for reference.
type SavedStarGift struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// If set, the gift sender in from_id and the message are set only for the receiver of
	// the gift.
	NameHidden bool
	// If set, the gift is not pinned on the user's profile.
	Unsaved bool
	// This gift was upgraded to a collectible gift »¹ and then re-downgraded to a regular
	// gift because a request to refund the payment related to the upgrade was made, and the
	// money was returned.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#collectible-gifts
	Refunded bool
	// Only set for non-collectible gifts, if they can be upgraded to a collectible gift »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#collectible-gifts
	CanUpgrade bool
	// Whether this gift is pinned on top of the user's profile page.
	PinnedToTop bool
	// If set, someone already separately pre-paid¹ for the upgrade of this gift.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#prepaying-for-someone-elses-upgrade
	UpgradeSeparate bool
	// Sender of the gift (unset for anonymous gifts).
	//
	// Use SetFromID and GetFromID helpers.
	FromID PeerClass
	// Reception date of the gift.
	Date int
	// The collectible gift.
	Gift StarGiftClass
	// Message attached to the gift.
	//
	// Use SetMessage and GetMessage helpers.
	Message TextWithEntities
	// For gifts received by users, ID to use in inputSavedStarGiftUser¹ constructors.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/inputSavedStarGiftUser
	//
	// Use SetMsgID and GetMsgID helpers.
	MsgID int
	// For gifts received by channels, ID to use in inputSavedStarGiftChat¹ constructors.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/inputSavedStarGiftChat
	//
	// Use SetSavedID and GetSavedID helpers.
	SavedID int64
	// For non-collectible gifts, the receiver of this gift may convert it to this many
	// Telegram Stars, instead of displaying it on their profile page.
	//
	// Use SetConvertStars and GetConvertStars helpers.
	ConvertStars int64
	// Only for pre-paid non-collectible gifts, the number of Telegram Stars the sender has
	// already paid to convert the gift into a collectible gift »¹ (this is different from
	// the meaning of the flag in messageActionStarGift², where it signals the upgrade price
	// for not yet upgraded gifts).
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#collectible-gifts
	//  2) https://core.telegram.org/constructor/messageActionStarGift
	//
	// Use SetUpgradeStars and GetUpgradeStars helpers.
	UpgradeStars int64
	// If set, indicates that the current gift can't be exported to the TON blockchain »¹
	// yet: the owner will be able to export it at the specified unixtime.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#withdraw-a-collectible-gift-to-the-ton-blockchain
	//
	// Use SetCanExportAt and GetCanExportAt helpers.
	CanExportAt int
	// If set, indicates that the gift can be transferred »¹ to another user by paying the
	// specified amount of stars.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#transferring-collectible-gifts
	//
	// Use SetTransferStars and GetTransferStars helpers.
	TransferStars int64
	// If set, indicates that the current gift can't be transferred »¹ yet: the owner will
	// be able to transfer it at the specified unixtime.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#transferring-collectible-gifts
	//
	// Use SetCanTransferAt and GetCanTransferAt helpers.
	CanTransferAt int
	// If set, indicates that the current gift can't be resold »¹ yet: the owner will be
	// able to put it up for sale at the specified unixtime.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#reselling-collectible-gifts
	//
	// Use SetCanResellAt and GetCanResellAt helpers.
	CanResellAt int
	// IDs of the collections »¹ that this gift is a part of.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#gift-collections
	//
	// Use SetCollectionID and GetCollectionID helpers.
	CollectionID []int
	// Hash to prepay for a gift upgrade separately »¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#prepaying-for-someone-elses-upgrade
	//
	// Use SetPrepaidUpgradeHash and GetPrepaidUpgradeHash helpers.
	PrepaidUpgradeHash string
	// If set, the starGiftAttributeOriginalDetails¹ attribute of this gift may be removed
	// by paying the specified amount of stars, see here »² for the full flow.
	//
	// Links:
	//  1) https://core.telegram.org/constructor/starGiftAttributeOriginalDetails
	//  2) https://core.telegram.org/api/gifts#dropping-the-original-details-of-an-upgraded-gift
	//
	// Use SetDropOriginalDetailsStars and GetDropOriginalDetailsStars helpers.
	DropOriginalDetailsStars int64
	// Collectible number assigned to the gift, if already known.
	//
	// Use SetGiftNum and GetGiftNum helpers.
	GiftNum int
	// If set, this gift can be used for crafting »¹ only starting from the specified
	// unixtime.
	//
	// Links:
	//  1) https://core.telegram.org/api/gifts#crafting-collectible-gifts
	//
	// Use SetCanCraftAt and GetCanCraftAt helpers.
	CanCraftAt int
}

// SavedStarGiftTypeID is TL type id of SavedStarGift.
const SavedStarGiftTypeID = 0x41df43fc

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

func ( *SavedStarGift) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.NameHidden == false) {
		return false
	}
	if !(.Unsaved == false) {
		return false
	}
	if !(.Refunded == false) {
		return false
	}
	if !(.CanUpgrade == false) {
		return false
	}
	if !(.PinnedToTop == false) {
		return false
	}
	if !(.UpgradeSeparate == false) {
		return false
	}
	if !(.FromID == nil) {
		return false
	}
	if !(.Date == 0) {
		return false
	}
	if !(.Gift == nil) {
		return false
	}
	if !(.Message.Zero()) {
		return false
	}
	if !(.MsgID == 0) {
		return false
	}
	if !(.SavedID == 0) {
		return false
	}
	if !(.ConvertStars == 0) {
		return false
	}
	if !(.UpgradeStars == 0) {
		return false
	}
	if !(.CanExportAt == 0) {
		return false
	}
	if !(.TransferStars == 0) {
		return false
	}
	if !(.CanTransferAt == 0) {
		return false
	}
	if !(.CanResellAt == 0) {
		return false
	}
	if !(.CollectionID == nil) {
		return false
	}
	if !(.PrepaidUpgradeHash == "") {
		return false
	}
	if !(.DropOriginalDetailsStars == 0) {
		return false
	}
	if !(.GiftNum == 0) {
		return false
	}
	if !(.CanCraftAt == 0) {
		return false
	}

	return true
}

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

// FillFrom fills SavedStarGift from given interface.
func ( *SavedStarGift) ( interface {
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( bool)
	() ( PeerClass,  bool)
	() ( int)
	() ( StarGiftClass)
	() ( TextWithEntities,  bool)
	() ( int,  bool)
	() ( int64,  bool)
	() ( int64,  bool)
	() ( int64,  bool)
	() ( int,  bool)
	() ( int64,  bool)
	() ( int,  bool)
	() ( int,  bool)
	() ( []int,  bool)
	() ( string,  bool)
	() ( int64,  bool)
	() ( int,  bool)
	() ( int,  bool)
}) {
	.NameHidden = .()
	.Unsaved = .()
	.Refunded = .()
	.CanUpgrade = .()
	.PinnedToTop = .()
	.UpgradeSeparate = .()
	if ,  := .();  {
		.FromID = 
	}

	.Date = .()
	.Gift = .()
	if ,  := .();  {
		.Message = 
	}

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

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

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

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

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

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

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

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

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

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

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

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

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

}

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

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

// TypeInfo returns info about TL type.
func ( *SavedStarGift) () tdp.Type {
	 := tdp.Type{
		Name: "savedStarGift",
		ID:   SavedStarGiftTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "NameHidden",
			SchemaName: "name_hidden",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Unsaved",
			SchemaName: "unsaved",
			Null:       !.Flags.Has(5),
		},
		{
			Name:       "Refunded",
			SchemaName: "refunded",
			Null:       !.Flags.Has(9),
		},
		{
			Name:       "CanUpgrade",
			SchemaName: "can_upgrade",
			Null:       !.Flags.Has(10),
		},
		{
			Name:       "PinnedToTop",
			SchemaName: "pinned_to_top",
			Null:       !.Flags.Has(12),
		},
		{
			Name:       "UpgradeSeparate",
			SchemaName: "upgrade_separate",
			Null:       !.Flags.Has(17),
		},
		{
			Name:       "FromID",
			SchemaName: "from_id",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Date",
			SchemaName: "date",
		},
		{
			Name:       "Gift",
			SchemaName: "gift",
		},
		{
			Name:       "Message",
			SchemaName: "message",
			Null:       !.Flags.Has(2),
		},
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
			Null:       !.Flags.Has(3),
		},
		{
			Name:       "SavedID",
			SchemaName: "saved_id",
			Null:       !.Flags.Has(11),
		},
		{
			Name:       "ConvertStars",
			SchemaName: "convert_stars",
			Null:       !.Flags.Has(4),
		},
		{
			Name:       "UpgradeStars",
			SchemaName: "upgrade_stars",
			Null:       !.Flags.Has(6),
		},
		{
			Name:       "CanExportAt",
			SchemaName: "can_export_at",
			Null:       !.Flags.Has(7),
		},
		{
			Name:       "TransferStars",
			SchemaName: "transfer_stars",
			Null:       !.Flags.Has(8),
		},
		{
			Name:       "CanTransferAt",
			SchemaName: "can_transfer_at",
			Null:       !.Flags.Has(13),
		},
		{
			Name:       "CanResellAt",
			SchemaName: "can_resell_at",
			Null:       !.Flags.Has(14),
		},
		{
			Name:       "CollectionID",
			SchemaName: "collection_id",
			Null:       !.Flags.Has(15),
		},
		{
			Name:       "PrepaidUpgradeHash",
			SchemaName: "prepaid_upgrade_hash",
			Null:       !.Flags.Has(16),
		},
		{
			Name:       "DropOriginalDetailsStars",
			SchemaName: "drop_original_details_stars",
			Null:       !.Flags.Has(18),
		},
		{
			Name:       "GiftNum",
			SchemaName: "gift_num",
			Null:       !.Flags.Has(19),
		},
		{
			Name:       "CanCraftAt",
			SchemaName: "can_craft_at",
			Null:       !.Flags.Has(20),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *SavedStarGift) () {
	if !(.NameHidden == false) {
		.Flags.Set(0)
	}
	if !(.Unsaved == false) {
		.Flags.Set(5)
	}
	if !(.Refunded == false) {
		.Flags.Set(9)
	}
	if !(.CanUpgrade == false) {
		.Flags.Set(10)
	}
	if !(.PinnedToTop == false) {
		.Flags.Set(12)
	}
	if !(.UpgradeSeparate == false) {
		.Flags.Set(17)
	}
	if !(.FromID == nil) {
		.Flags.Set(1)
	}
	if !(.Message.Zero()) {
		.Flags.Set(2)
	}
	if !(.MsgID == 0) {
		.Flags.Set(3)
	}
	if !(.SavedID == 0) {
		.Flags.Set(11)
	}
	if !(.ConvertStars == 0) {
		.Flags.Set(4)
	}
	if !(.UpgradeStars == 0) {
		.Flags.Set(6)
	}
	if !(.CanExportAt == 0) {
		.Flags.Set(7)
	}
	if !(.TransferStars == 0) {
		.Flags.Set(8)
	}
	if !(.CanTransferAt == 0) {
		.Flags.Set(13)
	}
	if !(.CanResellAt == 0) {
		.Flags.Set(14)
	}
	if !(.CollectionID == nil) {
		.Flags.Set(15)
	}
	if !(.PrepaidUpgradeHash == "") {
		.Flags.Set(16)
	}
	if !(.DropOriginalDetailsStars == 0) {
		.Flags.Set(18)
	}
	if !(.GiftNum == 0) {
		.Flags.Set(19)
	}
	if !(.CanCraftAt == 0) {
		.Flags.Set(20)
	}
}

// Encode implements bin.Encoder.
func ( *SavedStarGift) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode savedStarGift#41df43fc as nil")
	}
	.PutID(SavedStarGiftTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *SavedStarGift) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode savedStarGift#41df43fc as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode savedStarGift#41df43fc: field flags: %w", )
	}
	if .Flags.Has(1) {
		if .FromID == nil {
			return fmt.Errorf("unable to encode savedStarGift#41df43fc: field from_id is nil")
		}
		if  := .FromID.Encode();  != nil {
			return fmt.Errorf("unable to encode savedStarGift#41df43fc: field from_id: %w", )
		}
	}
	.PutInt(.Date)
	if .Gift == nil {
		return fmt.Errorf("unable to encode savedStarGift#41df43fc: field gift is nil")
	}
	if  := .Gift.Encode();  != nil {
		return fmt.Errorf("unable to encode savedStarGift#41df43fc: field gift: %w", )
	}
	if .Flags.Has(2) {
		if  := .Message.Encode();  != nil {
			return fmt.Errorf("unable to encode savedStarGift#41df43fc: field message: %w", )
		}
	}
	if .Flags.Has(3) {
		.PutInt(.MsgID)
	}
	if .Flags.Has(11) {
		.PutLong(.SavedID)
	}
	if .Flags.Has(4) {
		.PutLong(.ConvertStars)
	}
	if .Flags.Has(6) {
		.PutLong(.UpgradeStars)
	}
	if .Flags.Has(7) {
		.PutInt(.CanExportAt)
	}
	if .Flags.Has(8) {
		.PutLong(.TransferStars)
	}
	if .Flags.Has(13) {
		.PutInt(.CanTransferAt)
	}
	if .Flags.Has(14) {
		.PutInt(.CanResellAt)
	}
	if .Flags.Has(15) {
		.PutVectorHeader(len(.CollectionID))
		for ,  := range .CollectionID {
			.PutInt()
		}
	}
	if .Flags.Has(16) {
		.PutString(.PrepaidUpgradeHash)
	}
	if .Flags.Has(18) {
		.PutLong(.DropOriginalDetailsStars)
	}
	if .Flags.Has(19) {
		.PutInt(.GiftNum)
	}
	if .Flags.Has(20) {
		.PutInt(.CanCraftAt)
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *SavedStarGift) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode savedStarGift#41df43fc to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field flags: %w", )
		}
	}
	.NameHidden = .Flags.Has(0)
	.Unsaved = .Flags.Has(5)
	.Refunded = .Flags.Has(9)
	.CanUpgrade = .Flags.Has(10)
	.PinnedToTop = .Flags.Has(12)
	.UpgradeSeparate = .Flags.Has(17)
	if .Flags.Has(1) {
		,  := DecodePeer()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field from_id: %w", )
		}
		.FromID = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field date: %w", )
		}
		.Date = 
	}
	{
		,  := DecodeStarGift()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field gift: %w", )
		}
		.Gift = 
	}
	if .Flags.Has(2) {
		if  := .Message.Decode();  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field message: %w", )
		}
	}
	if .Flags.Has(3) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field msg_id: %w", )
		}
		.MsgID = 
	}
	if .Flags.Has(11) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field saved_id: %w", )
		}
		.SavedID = 
	}
	if .Flags.Has(4) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field convert_stars: %w", )
		}
		.ConvertStars = 
	}
	if .Flags.Has(6) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field upgrade_stars: %w", )
		}
		.UpgradeStars = 
	}
	if .Flags.Has(7) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_export_at: %w", )
		}
		.CanExportAt = 
	}
	if .Flags.Has(8) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field transfer_stars: %w", )
		}
		.TransferStars = 
	}
	if .Flags.Has(13) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_transfer_at: %w", )
		}
		.CanTransferAt = 
	}
	if .Flags.Has(14) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_resell_at: %w", )
		}
		.CanResellAt = 
	}
	if .Flags.Has(15) {
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field collection_id: %w", )
		}

		if  > 0 {
			.CollectionID = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode savedStarGift#41df43fc: field collection_id: %w", )
			}
			.CollectionID = append(.CollectionID, )
		}
	}
	if .Flags.Has(16) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field prepaid_upgrade_hash: %w", )
		}
		.PrepaidUpgradeHash = 
	}
	if .Flags.Has(18) {
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field drop_original_details_stars: %w", )
		}
		.DropOriginalDetailsStars = 
	}
	if .Flags.Has(19) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field gift_num: %w", )
		}
		.GiftNum = 
	}
	if .Flags.Has(20) {
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode savedStarGift#41df43fc: field can_craft_at: %w", )
		}
		.CanCraftAt = 
	}
	return nil
}

// SetNameHidden sets value of NameHidden conditional field.
func ( *SavedStarGift) ( bool) {
	if  {
		.Flags.Set(0)
		.NameHidden = true
	} else {
		.Flags.Unset(0)
		.NameHidden = false
	}
}

// GetNameHidden returns value of NameHidden conditional field.
func ( *SavedStarGift) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// SetUnsaved sets value of Unsaved conditional field.
func ( *SavedStarGift) ( bool) {
	if  {
		.Flags.Set(5)
		.Unsaved = true
	} else {
		.Flags.Unset(5)
		.Unsaved = false
	}
}

// GetUnsaved returns value of Unsaved conditional field.
func ( *SavedStarGift) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(5)
}

// SetRefunded sets value of Refunded conditional field.
func ( *SavedStarGift) ( bool) {
	if  {
		.Flags.Set(9)
		.Refunded = true
	} else {
		.Flags.Unset(9)
		.Refunded = false
	}
}

// GetRefunded returns value of Refunded conditional field.
func ( *SavedStarGift) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(9)
}

// SetCanUpgrade sets value of CanUpgrade conditional field.
func ( *SavedStarGift) ( bool) {
	if  {
		.Flags.Set(10)
		.CanUpgrade = true
	} else {
		.Flags.Unset(10)
		.CanUpgrade = false
	}
}

// GetCanUpgrade returns value of CanUpgrade conditional field.
func ( *SavedStarGift) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(10)
}

// SetPinnedToTop sets value of PinnedToTop conditional field.
func ( *SavedStarGift) ( bool) {
	if  {
		.Flags.Set(12)
		.PinnedToTop = true
	} else {
		.Flags.Unset(12)
		.PinnedToTop = false
	}
}

// GetPinnedToTop returns value of PinnedToTop conditional field.
func ( *SavedStarGift) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(12)
}

// SetUpgradeSeparate sets value of UpgradeSeparate conditional field.
func ( *SavedStarGift) ( bool) {
	if  {
		.Flags.Set(17)
		.UpgradeSeparate = true
	} else {
		.Flags.Unset(17)
		.UpgradeSeparate = false
	}
}

// GetUpgradeSeparate returns value of UpgradeSeparate conditional field.
func ( *SavedStarGift) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(17)
}

// SetFromID sets value of FromID conditional field.
func ( *SavedStarGift) ( PeerClass) {
	.Flags.Set(1)
	.FromID = 
}

// GetFromID returns value of FromID conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( PeerClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .FromID, true
}

// GetDate returns value of Date field.
func ( *SavedStarGift) () ( int) {
	if  == nil {
		return
	}
	return .Date
}

// GetGift returns value of Gift field.
func ( *SavedStarGift) () ( StarGiftClass) {
	if  == nil {
		return
	}
	return .Gift
}

// SetMessage sets value of Message conditional field.
func ( *SavedStarGift) ( TextWithEntities) {
	.Flags.Set(2)
	.Message = 
}

// GetMessage returns value of Message conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( TextWithEntities,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(2) {
		return , false
	}
	return .Message, true
}

// SetMsgID sets value of MsgID conditional field.
func ( *SavedStarGift) ( int) {
	.Flags.Set(3)
	.MsgID = 
}

// GetMsgID returns value of MsgID conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(3) {
		return , false
	}
	return .MsgID, true
}

// SetSavedID sets value of SavedID conditional field.
func ( *SavedStarGift) ( int64) {
	.Flags.Set(11)
	.SavedID = 
}

// GetSavedID returns value of SavedID conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(11) {
		return , false
	}
	return .SavedID, true
}

// SetConvertStars sets value of ConvertStars conditional field.
func ( *SavedStarGift) ( int64) {
	.Flags.Set(4)
	.ConvertStars = 
}

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

// SetUpgradeStars sets value of UpgradeStars conditional field.
func ( *SavedStarGift) ( int64) {
	.Flags.Set(6)
	.UpgradeStars = 
}

// GetUpgradeStars returns value of UpgradeStars conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(6) {
		return , false
	}
	return .UpgradeStars, true
}

// SetCanExportAt sets value of CanExportAt conditional field.
func ( *SavedStarGift) ( int) {
	.Flags.Set(7)
	.CanExportAt = 
}

// GetCanExportAt returns value of CanExportAt conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(7) {
		return , false
	}
	return .CanExportAt, true
}

// SetTransferStars sets value of TransferStars conditional field.
func ( *SavedStarGift) ( int64) {
	.Flags.Set(8)
	.TransferStars = 
}

// GetTransferStars returns value of TransferStars conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(8) {
		return , false
	}
	return .TransferStars, true
}

// SetCanTransferAt sets value of CanTransferAt conditional field.
func ( *SavedStarGift) ( int) {
	.Flags.Set(13)
	.CanTransferAt = 
}

// GetCanTransferAt returns value of CanTransferAt conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(13) {
		return , false
	}
	return .CanTransferAt, true
}

// SetCanResellAt sets value of CanResellAt conditional field.
func ( *SavedStarGift) ( int) {
	.Flags.Set(14)
	.CanResellAt = 
}

// GetCanResellAt returns value of CanResellAt conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(14) {
		return , false
	}
	return .CanResellAt, true
}

// SetCollectionID sets value of CollectionID conditional field.
func ( *SavedStarGift) ( []int) {
	.Flags.Set(15)
	.CollectionID = 
}

// GetCollectionID returns value of CollectionID conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( []int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(15) {
		return , false
	}
	return .CollectionID, true
}

// SetPrepaidUpgradeHash sets value of PrepaidUpgradeHash conditional field.
func ( *SavedStarGift) ( string) {
	.Flags.Set(16)
	.PrepaidUpgradeHash = 
}

// GetPrepaidUpgradeHash returns value of PrepaidUpgradeHash conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(16) {
		return , false
	}
	return .PrepaidUpgradeHash, true
}

// SetDropOriginalDetailsStars sets value of DropOriginalDetailsStars conditional field.
func ( *SavedStarGift) ( int64) {
	.Flags.Set(18)
	.DropOriginalDetailsStars = 
}

// GetDropOriginalDetailsStars returns value of DropOriginalDetailsStars conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( int64,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(18) {
		return , false
	}
	return .DropOriginalDetailsStars, true
}

// SetGiftNum sets value of GiftNum conditional field.
func ( *SavedStarGift) ( int) {
	.Flags.Set(19)
	.GiftNum = 
}

// GetGiftNum returns value of GiftNum conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(19) {
		return , false
	}
	return .GiftNum, true
}

// SetCanCraftAt sets value of CanCraftAt conditional field.
func ( *SavedStarGift) ( int) {
	.Flags.Set(20)
	.CanCraftAt = 
}

// GetCanCraftAt returns value of CanCraftAt conditional field and
// boolean which is true if field was set.
func ( *SavedStarGift) () ( int,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(20) {
		return , false
	}
	return .CanCraftAt, true
}