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

// PaymentsDepositStarGiftRequest represents TL type `payments.depositStarGift#c0a2ea9f`.
//
// See https://core.telegram.org/method/payments.depositStarGift for reference.
type PaymentsDepositStarGiftRequest struct {
	// Flags field of PaymentsDepositStarGiftRequest.
	Flags bin.Fields
	// HideSender field of PaymentsDepositStarGiftRequest.
	HideSender bool
	// Peer field of PaymentsDepositStarGiftRequest.
	Peer InputPeerClass
	// Slug field of PaymentsDepositStarGiftRequest.
	Slug string
}

// PaymentsDepositStarGiftRequestTypeID is TL type id of PaymentsDepositStarGiftRequest.
const PaymentsDepositStarGiftRequestTypeID = 0xc0a2ea9f

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

func ( *PaymentsDepositStarGiftRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.HideSender == false) {
		return false
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.Slug == "") {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsDepositStarGiftRequest from given interface.
func ( *PaymentsDepositStarGiftRequest) ( interface {
	() ( bool)
	() ( InputPeerClass)
	() ( string)
}) {
	.HideSender = .()
	.Peer = .()
	.Slug = .()
}

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

// TypeName returns name of type in TL schema.
func (*PaymentsDepositStarGiftRequest) () string {
	return "payments.depositStarGift"
}

// TypeInfo returns info about TL type.
func ( *PaymentsDepositStarGiftRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.depositStarGift",
		ID:   PaymentsDepositStarGiftRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "HideSender",
			SchemaName: "hide_sender",
			Null:       !.Flags.Has(0),
		},
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "Slug",
			SchemaName: "slug",
		},
	}
	return 
}

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

// Encode implements bin.Encoder.
func ( *PaymentsDepositStarGiftRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.depositStarGift#c0a2ea9f as nil")
	}
	.PutID(PaymentsDepositStarGiftRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsDepositStarGiftRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.depositStarGift#c0a2ea9f as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.depositStarGift#c0a2ea9f: field flags: %w", )
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode payments.depositStarGift#c0a2ea9f: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.depositStarGift#c0a2ea9f: field peer: %w", )
	}
	.PutString(.Slug)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsDepositStarGiftRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.depositStarGift#c0a2ea9f to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode payments.depositStarGift#c0a2ea9f: field flags: %w", )
		}
	}
	.HideSender = .Flags.Has(0)
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode payments.depositStarGift#c0a2ea9f: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode payments.depositStarGift#c0a2ea9f: field slug: %w", )
		}
		.Slug = 
	}
	return nil
}

// SetHideSender sets value of HideSender conditional field.
func ( *PaymentsDepositStarGiftRequest) ( bool) {
	if  {
		.Flags.Set(0)
		.HideSender = true
	} else {
		.Flags.Unset(0)
		.HideSender = false
	}
}

// GetHideSender returns value of HideSender conditional field.
func ( *PaymentsDepositStarGiftRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}

// GetPeer returns value of Peer field.
func ( *PaymentsDepositStarGiftRequest) () ( InputPeerClass) {
	if  == nil {
		return
	}
	return .Peer
}

// GetSlug returns value of Slug field.
func ( *PaymentsDepositStarGiftRequest) () ( string) {
	if  == nil {
		return
	}
	return .Slug
}

// PaymentsDepositStarGift invokes method payments.depositStarGift#c0a2ea9f returning error if any.
//
// See https://core.telegram.org/method/payments.depositStarGift for reference.
func ( *Client) ( context.Context,  *PaymentsDepositStarGiftRequest) (*PaymentsStarGiftDepositPayload, error) {
	var  PaymentsStarGiftDepositPayload

	if  := .rpc.Invoke(, , &);  != nil {
		return nil, 
	}
	return &, nil
}