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

// PhoneToggleGroupCallStartSubscriptionRequest represents TL type `phone.toggleGroupCallStartSubscription#219c34e6`.
// Subscribe or unsubscribe to a scheduled group call
//
// See https://core.telegram.org/method/phone.toggleGroupCallStartSubscription for reference.
type PhoneToggleGroupCallStartSubscriptionRequest struct {
	// Scheduled group call
	Call InputGroupCall
	// Enable or disable subscription
	Subscribed bool
}

// PhoneToggleGroupCallStartSubscriptionRequestTypeID is TL type id of PhoneToggleGroupCallStartSubscriptionRequest.
const PhoneToggleGroupCallStartSubscriptionRequestTypeID = 0x219c34e6

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

func ( *PhoneToggleGroupCallStartSubscriptionRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Call.Zero()) {
		return false
	}
	if !(.Subscribed == false) {
		return false
	}

	return true
}

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

// FillFrom fills PhoneToggleGroupCallStartSubscriptionRequest from given interface.
func ( *PhoneToggleGroupCallStartSubscriptionRequest) ( interface {
	() ( InputGroupCall)
	() ( bool)
}) {
	.Call = .()
	.Subscribed = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhoneToggleGroupCallStartSubscriptionRequest) () tdp.Type {
	 := tdp.Type{
		Name: "phone.toggleGroupCallStartSubscription",
		ID:   PhoneToggleGroupCallStartSubscriptionRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Call",
			SchemaName: "call",
		},
		{
			Name:       "Subscribed",
			SchemaName: "subscribed",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhoneToggleGroupCallStartSubscriptionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.toggleGroupCallStartSubscription#219c34e6 as nil")
	}
	.PutID(PhoneToggleGroupCallStartSubscriptionRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhoneToggleGroupCallStartSubscriptionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode phone.toggleGroupCallStartSubscription#219c34e6 as nil")
	}
	if  := .Call.Encode();  != nil {
		return fmt.Errorf("unable to encode phone.toggleGroupCallStartSubscription#219c34e6: field call: %w", )
	}
	.PutBool(.Subscribed)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhoneToggleGroupCallStartSubscriptionRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode phone.toggleGroupCallStartSubscription#219c34e6 to nil")
	}
	{
		if  := .Call.Decode();  != nil {
			return fmt.Errorf("unable to decode phone.toggleGroupCallStartSubscription#219c34e6: field call: %w", )
		}
	}
	{
		,  := .Bool()
		if  != nil {
			return fmt.Errorf("unable to decode phone.toggleGroupCallStartSubscription#219c34e6: field subscribed: %w", )
		}
		.Subscribed = 
	}
	return nil
}

// GetCall returns value of Call field.
func ( *PhoneToggleGroupCallStartSubscriptionRequest) () ( InputGroupCall) {
	if  == nil {
		return
	}
	return .Call
}

// GetSubscribed returns value of Subscribed field.
func ( *PhoneToggleGroupCallStartSubscriptionRequest) () ( bool) {
	if  == nil {
		return
	}
	return .Subscribed
}

// PhoneToggleGroupCallStartSubscription invokes method phone.toggleGroupCallStartSubscription#219c34e6 returning error if any.
// Subscribe or unsubscribe to a scheduled group call
//
// Possible errors:
//
//	403 GROUPCALL_ALREADY_STARTED: The groupcall has already started, you can join directly using phone.joinGroupCall.
//
// See https://core.telegram.org/method/phone.toggleGroupCallStartSubscription for reference.
func ( *Client) ( context.Context,  *PhoneToggleGroupCallStartSubscriptionRequest) (UpdatesClass, error) {
	var  UpdatesBox

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