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

// HelpSupport represents TL type `help.support#17c6b5f6`.
// Info on support user.
//
// See https://core.telegram.org/constructor/help.support for reference.
type HelpSupport struct {
	// Phone number
	PhoneNumber string
	// User
	User UserClass
}

// HelpSupportTypeID is TL type id of HelpSupport.
const HelpSupportTypeID = 0x17c6b5f6

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

func ( *HelpSupport) () bool {
	if  == nil {
		return true
	}
	if !(.PhoneNumber == "") {
		return false
	}
	if !(.User == nil) {
		return false
	}

	return true
}

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

// FillFrom fills HelpSupport from given interface.
func ( *HelpSupport) ( interface {
	() ( string)
	() ( UserClass)
}) {
	.PhoneNumber = .()
	.User = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *HelpSupport) () tdp.Type {
	 := tdp.Type{
		Name: "help.support",
		ID:   HelpSupportTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "PhoneNumber",
			SchemaName: "phone_number",
		},
		{
			Name:       "User",
			SchemaName: "user",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *HelpSupport) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.support#17c6b5f6 as nil")
	}
	.PutID(HelpSupportTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *HelpSupport) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode help.support#17c6b5f6 as nil")
	}
	.PutString(.PhoneNumber)
	if .User == nil {
		return fmt.Errorf("unable to encode help.support#17c6b5f6: field user is nil")
	}
	if  := .User.Encode();  != nil {
		return fmt.Errorf("unable to encode help.support#17c6b5f6: field user: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *HelpSupport) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode help.support#17c6b5f6 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode help.support#17c6b5f6: field phone_number: %w", )
		}
		.PhoneNumber = 
	}
	{
		,  := DecodeUser()
		if  != nil {
			return fmt.Errorf("unable to decode help.support#17c6b5f6: field user: %w", )
		}
		.User = 
	}
	return nil
}

// GetPhoneNumber returns value of PhoneNumber field.
func ( *HelpSupport) () ( string) {
	if  == nil {
		return
	}
	return .PhoneNumber
}

// GetUser returns value of User field.
func ( *HelpSupport) () ( UserClass) {
	if  == nil {
		return
	}
	return .User
}

// GetUserAsNotEmpty returns mapped value of User field.
func ( *HelpSupport) () (*User, bool) {
	return .User.AsNotEmpty()
}