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

// PaymentsGetPremiumGiftCodeOptionsRequest represents TL type `payments.getPremiumGiftCodeOptions#2757ba54`.
// Obtain a list of Telegram Premium giveaway/gift code »¹ options.
//
// Links:
//  1. https://core.telegram.org/api/giveaways
//
// See https://core.telegram.org/method/payments.getPremiumGiftCodeOptions for reference.
type PaymentsGetPremiumGiftCodeOptionsRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// The channel that will start the giveaway
	//
	// Use SetBoostPeer and GetBoostPeer helpers.
	BoostPeer InputPeerClass
}

// PaymentsGetPremiumGiftCodeOptionsRequestTypeID is TL type id of PaymentsGetPremiumGiftCodeOptionsRequest.
const PaymentsGetPremiumGiftCodeOptionsRequestTypeID = 0x2757ba54

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

func ( *PaymentsGetPremiumGiftCodeOptionsRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.BoostPeer == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsGetPremiumGiftCodeOptionsRequest from given interface.
func ( *PaymentsGetPremiumGiftCodeOptionsRequest) ( interface {
	() ( InputPeerClass,  bool)
}) {
	if ,  := .();  {
		.BoostPeer = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *PaymentsGetPremiumGiftCodeOptionsRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.getPremiumGiftCodeOptions",
		ID:   PaymentsGetPremiumGiftCodeOptionsRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "BoostPeer",
			SchemaName: "boost_peer",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

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

// Encode implements bin.Encoder.
func ( *PaymentsGetPremiumGiftCodeOptionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getPremiumGiftCodeOptions#2757ba54 as nil")
	}
	.PutID(PaymentsGetPremiumGiftCodeOptionsRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsGetPremiumGiftCodeOptionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getPremiumGiftCodeOptions#2757ba54 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.getPremiumGiftCodeOptions#2757ba54: field flags: %w", )
	}
	if .Flags.Has(0) {
		if .BoostPeer == nil {
			return fmt.Errorf("unable to encode payments.getPremiumGiftCodeOptions#2757ba54: field boost_peer is nil")
		}
		if  := .BoostPeer.Encode();  != nil {
			return fmt.Errorf("unable to encode payments.getPremiumGiftCodeOptions#2757ba54: field boost_peer: %w", )
		}
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsGetPremiumGiftCodeOptionsRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getPremiumGiftCodeOptions#2757ba54 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode payments.getPremiumGiftCodeOptions#2757ba54: field flags: %w", )
		}
	}
	if .Flags.Has(0) {
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getPremiumGiftCodeOptions#2757ba54: field boost_peer: %w", )
		}
		.BoostPeer = 
	}
	return nil
}

// SetBoostPeer sets value of BoostPeer conditional field.
func ( *PaymentsGetPremiumGiftCodeOptionsRequest) ( InputPeerClass) {
	.Flags.Set(0)
	.BoostPeer = 
}

// GetBoostPeer returns value of BoostPeer conditional field and
// boolean which is true if field was set.
func ( *PaymentsGetPremiumGiftCodeOptionsRequest) () ( InputPeerClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .BoostPeer, true
}

// PaymentsGetPremiumGiftCodeOptions invokes method payments.getPremiumGiftCodeOptions#2757ba54 returning error if any.
// Obtain a list of Telegram Premium giveaway/gift code »¹ options.
//
// Links:
//  1. https://core.telegram.org/api/giveaways
//
// See https://core.telegram.org/method/payments.getPremiumGiftCodeOptions for reference.
func ( *Client) ( context.Context,  *PaymentsGetPremiumGiftCodeOptionsRequest) ([]PremiumGiftCodeOption, error) {
	var  PremiumGiftCodeOptionVector

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