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

// PaymentsAssignPlayMarketTransactionRequest represents TL type `payments.assignPlayMarketTransaction#dffd50d3`.
// Informs server about a purchase made through the Play Store: for official applications
// only.
//
// See https://core.telegram.org/method/payments.assignPlayMarketTransaction for reference.
type PaymentsAssignPlayMarketTransactionRequest struct {
	// Receipt
	Receipt DataJSON
	// Payment purpose
	Purpose InputStorePaymentPurposeClass
}

// PaymentsAssignPlayMarketTransactionRequestTypeID is TL type id of PaymentsAssignPlayMarketTransactionRequest.
const PaymentsAssignPlayMarketTransactionRequestTypeID = 0xdffd50d3

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

func ( *PaymentsAssignPlayMarketTransactionRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Receipt.Zero()) {
		return false
	}
	if !(.Purpose == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PaymentsAssignPlayMarketTransactionRequest from given interface.
func ( *PaymentsAssignPlayMarketTransactionRequest) ( interface {
	() ( DataJSON)
	() ( InputStorePaymentPurposeClass)
}) {
	.Receipt = .()
	.Purpose = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PaymentsAssignPlayMarketTransactionRequest) () tdp.Type {
	 := tdp.Type{
		Name: "payments.assignPlayMarketTransaction",
		ID:   PaymentsAssignPlayMarketTransactionRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Receipt",
			SchemaName: "receipt",
		},
		{
			Name:       "Purpose",
			SchemaName: "purpose",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PaymentsAssignPlayMarketTransactionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.assignPlayMarketTransaction#dffd50d3 as nil")
	}
	.PutID(PaymentsAssignPlayMarketTransactionRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PaymentsAssignPlayMarketTransactionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.assignPlayMarketTransaction#dffd50d3 as nil")
	}
	if  := .Receipt.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.assignPlayMarketTransaction#dffd50d3: field receipt: %w", )
	}
	if .Purpose == nil {
		return fmt.Errorf("unable to encode payments.assignPlayMarketTransaction#dffd50d3: field purpose is nil")
	}
	if  := .Purpose.Encode();  != nil {
		return fmt.Errorf("unable to encode payments.assignPlayMarketTransaction#dffd50d3: field purpose: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PaymentsAssignPlayMarketTransactionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode payments.assignPlayMarketTransaction#dffd50d3 to nil")
	}
	{
		if  := .Receipt.Decode();  != nil {
			return fmt.Errorf("unable to decode payments.assignPlayMarketTransaction#dffd50d3: field receipt: %w", )
		}
	}
	{
		,  := DecodeInputStorePaymentPurpose()
		if  != nil {
			return fmt.Errorf("unable to decode payments.assignPlayMarketTransaction#dffd50d3: field purpose: %w", )
		}
		.Purpose = 
	}
	return nil
}

// GetReceipt returns value of Receipt field.
func ( *PaymentsAssignPlayMarketTransactionRequest) () ( DataJSON) {
	if  == nil {
		return
	}
	return .Receipt
}

// GetPurpose returns value of Purpose field.
func ( *PaymentsAssignPlayMarketTransactionRequest) () ( InputStorePaymentPurposeClass) {
	if  == nil {
		return
	}
	return .Purpose
}

// PaymentsAssignPlayMarketTransaction invokes method payments.assignPlayMarketTransaction#dffd50d3 returning error if any.
// Informs server about a purchase made through the Play Store: for official applications
// only.
//
// See https://core.telegram.org/method/payments.assignPlayMarketTransaction for reference.
func ( *Client) ( context.Context,  *PaymentsAssignPlayMarketTransactionRequest) (UpdatesClass, error) {
	var  UpdatesBox

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