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

// PhoneSendSignalingDataRequest represents TL type `phone.sendSignalingData#ff7a9383`.
// Send VoIP signaling data
//
// See https://core.telegram.org/method/phone.sendSignalingData for reference.
type PhoneSendSignalingDataRequest struct {
	// Phone call
	Peer InputPhoneCall
	// Signaling payload
	Data []byte
}

// PhoneSendSignalingDataRequestTypeID is TL type id of PhoneSendSignalingDataRequest.
const PhoneSendSignalingDataRequestTypeID = 0xff7a9383

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

func ( *PhoneSendSignalingDataRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Peer.Zero()) {
		return false
	}
	if !(.Data == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneSendSignalingDataRequest from given interface.
func ( *PhoneSendSignalingDataRequest) ( interface {
	() ( InputPhoneCall)
	() ( []byte)
}) {
	.Peer = .()
	.Data = .()
}

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

// TypeName returns name of type in TL schema.
func (*PhoneSendSignalingDataRequest) () string {
	return "phone.sendSignalingData"
}

// TypeInfo returns info about TL type.
func ( *PhoneSendSignalingDataRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.sendSignalingData",
		ID:   PhoneSendSignalingDataRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Peer",
			SchemaName: "peer",
		},
		{
			Name:       "Data",
			SchemaName: "data",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhoneSendSignalingDataRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.sendSignalingData#ff7a9383 as nil")
	}
	.PutID(PhoneSendSignalingDataRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneSendSignalingDataRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.sendSignalingData#ff7a9383 as nil")
	}
	if  := .Peer.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.sendSignalingData#ff7a9383: field peer: %w", )
	}
	.PutBytes(.Data)
	return nil
}

// Decode implements bin.Decoder.
func ( *PhoneSendSignalingDataRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.sendSignalingData#ff7a9383 to nil")
	}
	if  := .ConsumeID(PhoneSendSignalingDataRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode phone.sendSignalingData#ff7a9383: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *PhoneSendSignalingDataRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.sendSignalingData#ff7a9383 to nil")
	}
	{
		if  := .Peer.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.sendSignalingData#ff7a9383: field peer: %w", )
		}
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode phone.sendSignalingData#ff7a9383: field data: %w", )
		}
		.Data = 
	}
	return nil
}

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

// GetData returns value of Data field.
func ( *PhoneSendSignalingDataRequest) () ( []byte) {
	if  == nil {
		return
	}
	return .Data
}

// PhoneSendSignalingData invokes method phone.sendSignalingData#ff7a9383 returning error if any.
// Send VoIP signaling data
//
// See https://core.telegram.org/method/phone.sendSignalingData for reference.
func ( *Client) ( context.Context,  *PhoneSendSignalingDataRequest) (bool, error) {
	var  BoolBox

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