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

// PaymentsGetGiveawayInfoRequest represents TL type `payments.getGiveawayInfo#f4239425`.
// Obtain information about a Telegram Premium giveaway »¹.
//
// Links:
//  1. https://core.telegram.org/api/giveaways
//
// See https://core.telegram.org/method/payments.getGiveawayInfo for reference.
type PaymentsGetGiveawayInfoRequest struct {
	// The peer where the giveaway was posted.
	Peer InputPeerClass
	// Message ID of the messageActionGiveawayLaunch¹ service message
	//
	// Links:
	//  1) https://core.telegram.org/constructor/messageActionGiveawayLaunch
	MsgID int
}

// PaymentsGetGiveawayInfoRequestTypeID is TL type id of PaymentsGetGiveawayInfoRequest.
const PaymentsGetGiveawayInfoRequestTypeID = 0xf4239425

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

func ( *PaymentsGetGiveawayInfoRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer == nil) {
		return false
	}
	if !(.MsgID == 0) {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsGetGiveawayInfoRequest from given interface.
func ( *PaymentsGetGiveawayInfoRequest) ( interface {
	() ( InputPeerClass)
	() ( int)
}) {
	.Peer = .()
	.MsgID = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PaymentsGetGiveawayInfoRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.getGiveawayInfo",
		ID:   PaymentsGetGiveawayInfoRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "MsgID",
			SchemaName: "msg_id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentsGetGiveawayInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getGiveawayInfo#f4239425 as nil")
	}
	.PutID(PaymentsGetGiveawayInfoRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsGetGiveawayInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.getGiveawayInfo#f4239425 as nil")
	}
	if .Peer == nil {
		return fmt.Errorf("unable to encode payments.getGiveawayInfo#f4239425: field peer is nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.getGiveawayInfo#f4239425: field peer: %w", )
	}
	.PutInt(.MsgID)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsGetGiveawayInfoRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.getGiveawayInfo#f4239425 to nil")
	}
	{
		,  := DecodeInputPeer()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getGiveawayInfo#f4239425: field peer: %w", )
		}
		.Peer = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode payments.getGiveawayInfo#f4239425: field msg_id: %w", )
		}
		.MsgID = 
	}
	return nil
}

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

// GetMsgID returns value of MsgID field.
func ( *PaymentsGetGiveawayInfoRequest) () ( int) {
	if  == nil {
		return
	}
	return .MsgID
}

// PaymentsGetGiveawayInfo invokes method payments.getGiveawayInfo#f4239425 returning error if any.
// Obtain information about a Telegram Premium giveaway »¹.
//
// Links:
//  1. https://core.telegram.org/api/giveaways
//
// Possible errors:
//
//	400 PEER_ID_INVALID: The provided peer id is invalid.
//
// See https://core.telegram.org/method/payments.getGiveawayInfo for reference.
func ( *Client) ( context.Context,  *PaymentsGetGiveawayInfoRequest) (PaymentsGiveawayInfoClass, error) {
	var  PaymentsGiveawayInfoBox

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