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

// HelpAcceptTermsOfServiceRequest represents TL type `help.acceptTermsOfService#ee72f79a`.
// Accept the new terms of service
//
// See https://core.telegram.org/method/help.acceptTermsOfService for reference.
type HelpAcceptTermsOfServiceRequest struct {
	// ID of terms of service
	ID DataJSON
}

// HelpAcceptTermsOfServiceRequestTypeID is TL type id of HelpAcceptTermsOfServiceRequest.
const HelpAcceptTermsOfServiceRequestTypeID = 0xee72f79a

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

func ( *HelpAcceptTermsOfServiceRequest) () bool {
	if  == nil {
		return true
	}
	if !(.ID.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills HelpAcceptTermsOfServiceRequest from given interface.
func ( *HelpAcceptTermsOfServiceRequest) ( interface {
	() ( DataJSON)
}) {
	.ID = .()
}

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

// TypeName returns name of type in TL schema.
func (*HelpAcceptTermsOfServiceRequest) () string {
	return "help.acceptTermsOfService"
}

// TypeInfo returns info about TL type.
func ( *HelpAcceptTermsOfServiceRequest) () tdp.Type {
	 := tdp.Type{
		Name: "help.acceptTermsOfService",
		ID:   HelpAcceptTermsOfServiceRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *HelpAcceptTermsOfServiceRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.acceptTermsOfService#ee72f79a as nil")
	}
	.PutID(HelpAcceptTermsOfServiceRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *HelpAcceptTermsOfServiceRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.acceptTermsOfService#ee72f79a as nil")
	}
	if  := .ID.Encode();  != nil {
		return fmt.Errorf("unable to encode help.acceptTermsOfService#ee72f79a: field id: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *HelpAcceptTermsOfServiceRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode help.acceptTermsOfService#ee72f79a to nil")
	}
	if  := .ConsumeID(HelpAcceptTermsOfServiceRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode help.acceptTermsOfService#ee72f79a: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *HelpAcceptTermsOfServiceRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode help.acceptTermsOfService#ee72f79a to nil")
	}
	{
		if  := .ID.Decode();  != nil {
			return fmt.Errorf("unable to decode help.acceptTermsOfService#ee72f79a: field id: %w", )
		}
	}
	return nil
}

// GetID returns value of ID field.
func ( *HelpAcceptTermsOfServiceRequest) () ( DataJSON) {
	if  == nil {
		return
	}
	return .ID
}

// HelpAcceptTermsOfService invokes method help.acceptTermsOfService#ee72f79a returning error if any.
// Accept the new terms of service
//
// Possible errors:
//
//	400 DATA_JSON_INVALID: The provided JSON data is invalid.
//
// See https://core.telegram.org/method/help.acceptTermsOfService for reference.
func ( *Client) ( context.Context,  DataJSON) (bool, error) {
	var  BoolBox

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