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

// AccountUpdateBusinessLocationRequest represents TL type `account.updateBusinessLocation#9e6b131a`.
// Businesses »¹ may advertise their location using this method, see here »² for more
// info.
// To remove business location information invoke the method without setting any of the
// parameters.
//
// Links:
//  1. https://core.telegram.org/api/business#location
//  2. https://core.telegram.org/api/business#location
//
// See https://core.telegram.org/method/account.updateBusinessLocation for reference.
type AccountUpdateBusinessLocationRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Optional, contains a set of geographical coordinates.
	//
	// Use SetGeoPoint and GetGeoPoint helpers.
	GeoPoint InputGeoPointClass
	// Mandatory when setting/updating the location, contains a textual description of the
	// address (max 96 UTF-8 chars).
	//
	// Use SetAddress and GetAddress helpers.
	Address string
}

// AccountUpdateBusinessLocationRequestTypeID is TL type id of AccountUpdateBusinessLocationRequest.
const AccountUpdateBusinessLocationRequestTypeID = 0x9e6b131a

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

func ( *AccountUpdateBusinessLocationRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.GeoPoint == nil) {
		return false
	}
	if !(.Address == "") {
		return false
	}

	return true
}

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

// FillFrom fills AccountUpdateBusinessLocationRequest from given interface.
func ( *AccountUpdateBusinessLocationRequest) ( interface {
	() ( InputGeoPointClass,  bool)
	() ( string,  bool)
}) {
	if ,  := .();  {
		.GeoPoint = 
	}

	if ,  := .();  {
		.Address = 
	}

}

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

// TypeName returns name of type in TL schema.
func (*AccountUpdateBusinessLocationRequest) () string {
	return "account.updateBusinessLocation"
}

// TypeInfo returns info about TL type.
func ( *AccountUpdateBusinessLocationRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.updateBusinessLocation",
		ID:   AccountUpdateBusinessLocationRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "GeoPoint",
			SchemaName: "geo_point",
			Null:       !.Flags.Has(1),
		},
		{
			Name:       "Address",
			SchemaName: "address",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *AccountUpdateBusinessLocationRequest) () {
	if !(.GeoPoint == nil) {
		.Flags.Set(1)
	}
	if !(.Address == "") {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *AccountUpdateBusinessLocationRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.updateBusinessLocation#9e6b131a as nil")
	}
	.PutID(AccountUpdateBusinessLocationRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountUpdateBusinessLocationRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.updateBusinessLocation#9e6b131a as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode account.updateBusinessLocation#9e6b131a: field flags: %w", )
	}
	if .Flags.Has(1) {
		if .GeoPoint == nil {
			return fmt.Errorf("unable to encode account.updateBusinessLocation#9e6b131a: field geo_point is nil")
		}
		if  := .GeoPoint.Encode();  != nil {
			return fmt.Errorf("unable to encode account.updateBusinessLocation#9e6b131a: field geo_point: %w", )
		}
	}
	if .Flags.Has(0) {
		.PutString(.Address)
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountUpdateBusinessLocationRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.updateBusinessLocation#9e6b131a to nil")
	}
	if  := .ConsumeID(AccountUpdateBusinessLocationRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.updateBusinessLocation#9e6b131a: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountUpdateBusinessLocationRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.updateBusinessLocation#9e6b131a to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode account.updateBusinessLocation#9e6b131a: field flags: %w", )
		}
	}
	if .Flags.Has(1) {
		,  := DecodeInputGeoPoint()
		if  != nil {
			return fmt.Errorf("unable to decode account.updateBusinessLocation#9e6b131a: field geo_point: %w", )
		}
		.GeoPoint = 
	}
	if .Flags.Has(0) {
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode account.updateBusinessLocation#9e6b131a: field address: %w", )
		}
		.Address = 
	}
	return nil
}

// SetGeoPoint sets value of GeoPoint conditional field.
func ( *AccountUpdateBusinessLocationRequest) ( InputGeoPointClass) {
	.Flags.Set(1)
	.GeoPoint = 
}

// GetGeoPoint returns value of GeoPoint conditional field and
// boolean which is true if field was set.
func ( *AccountUpdateBusinessLocationRequest) () ( InputGeoPointClass,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(1) {
		return , false
	}
	return .GeoPoint, true
}

// SetAddress sets value of Address conditional field.
func ( *AccountUpdateBusinessLocationRequest) ( string) {
	.Flags.Set(0)
	.Address = 
}

// GetAddress returns value of Address conditional field and
// boolean which is true if field was set.
func ( *AccountUpdateBusinessLocationRequest) () ( string,  bool) {
	if  == nil {
		return
	}
	if !.Flags.Has(0) {
		return , false
	}
	return .Address, true
}

// GetGeoPointAsNotEmpty returns mapped value of GeoPoint conditional field and
// boolean which is true if field was set.
func ( *AccountUpdateBusinessLocationRequest) () (*InputGeoPoint, bool) {
	if ,  := .GetGeoPoint();  {
		return .AsNotEmpty()
	}
	return nil, false
}

// AccountUpdateBusinessLocation invokes method account.updateBusinessLocation#9e6b131a returning error if any.
// Businesses »¹ may advertise their location using this method, see here »² for more
// info.
// To remove business location information invoke the method without setting any of the
// parameters.
//
// Links:
//  1. https://core.telegram.org/api/business#location
//  2. https://core.telegram.org/api/business#location
//
// See https://core.telegram.org/method/account.updateBusinessLocation for reference.
func ( *Client) ( context.Context,  *AccountUpdateBusinessLocationRequest) (bool, error) {
	var  BoolBox

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