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

// PaymentsAssignAppStoreTransactionRequest represents TL type `payments.assignAppStoreTransaction#80ed747d`.
// Informs server about a purchase made through the App Store: for official applications
// only.
//
// See https://core.telegram.org/method/payments.assignAppStoreTransaction for reference.
type PaymentsAssignAppStoreTransactionRequest struct {
	// Receipt
	Receipt []byte
	// Payment purpose
	Purpose InputStorePaymentPurposeClass
}

// PaymentsAssignAppStoreTransactionRequestTypeID is TL type id of PaymentsAssignAppStoreTransactionRequest.
const PaymentsAssignAppStoreTransactionRequestTypeID = 0x80ed747d

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

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

	return true
}

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

// FillFrom fills PaymentsAssignAppStoreTransactionRequest from given interface.
func ( *PaymentsAssignAppStoreTransactionRequest) ( interface {
	() ( []byte)
	() ( InputStorePaymentPurposeClass)
}) {
	.Receipt = .()
	.Purpose = .()
}

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

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

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

// Encode implements bin.Encoder.
func ( *PaymentsAssignAppStoreTransactionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode payments.assignAppStoreTransaction#80ed747d as nil")
	}
	.PutID(PaymentsAssignAppStoreTransactionRequestTypeID)
	return .EncodeBare()
}

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

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

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

// GetReceipt returns value of Receipt field.
func ( *PaymentsAssignAppStoreTransactionRequest) () ( []byte) {
	if  == nil {
		return
	}
	return .Receipt
}

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

// PaymentsAssignAppStoreTransaction invokes method payments.assignAppStoreTransaction#80ed747d returning error if any.
// Informs server about a purchase made through the App Store: for official applications
// only.
//
// See https://core.telegram.org/method/payments.assignAppStoreTransaction for reference.
func ( *Client) ( context.Context,  *PaymentsAssignAppStoreTransactionRequest) (UpdatesClass, error) {
	var  UpdatesBox

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