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

// AccountUpdateBusinessWorkHoursRequest represents TL type `account.updateBusinessWorkHours#4b00e066`.
// Specify a set of Telegram Business opening hours¹.
// This info will be contained in userFull².business_work_hours.
// To remove all opening hours, invoke the method without setting the business_work_hours
// field.
// Note that the opening hours specified by the user must be appropriately validated and
// transformed before invoking the method, as specified here »¹.
//
// Links:
//  1. https://core.telegram.org/api/business#opening-hours
//  2. https://core.telegram.org/constructor/userFull
//  3. https://core.telegram.org/api/business#opening-hours
//
// See https://core.telegram.org/method/account.updateBusinessWorkHours for reference.
type AccountUpdateBusinessWorkHoursRequest struct {
	// Flags, see TL conditional fields¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Opening hours (optional, if not set removes all opening hours).
	//
	// Use SetBusinessWorkHours and GetBusinessWorkHours helpers.
	BusinessWorkHours BusinessWorkHours
}

// AccountUpdateBusinessWorkHoursRequestTypeID is TL type id of AccountUpdateBusinessWorkHoursRequest.
const AccountUpdateBusinessWorkHoursRequestTypeID = 0x4b00e066

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

func ( *AccountUpdateBusinessWorkHoursRequest) () bool {
	if  == nil {
		return true
	}
	if !(.Flags.Zero()) {
		return false
	}
	if !(.BusinessWorkHours.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills AccountUpdateBusinessWorkHoursRequest from given interface.
func ( *AccountUpdateBusinessWorkHoursRequest) ( interface {
	() ( BusinessWorkHours,  bool)
}) {
	if ,  := .();  {
		.BusinessWorkHours = 
	}

}

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

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

// TypeInfo returns info about TL type.
func ( *AccountUpdateBusinessWorkHoursRequest) () tdp.Type {
	 := tdp.Type{
		Name: "account.updateBusinessWorkHours",
		ID:   AccountUpdateBusinessWorkHoursRequestTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "BusinessWorkHours",
			SchemaName: "business_work_hours",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *AccountUpdateBusinessWorkHoursRequest) () {
	if !(.BusinessWorkHours.Zero()) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *AccountUpdateBusinessWorkHoursRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.updateBusinessWorkHours#4b00e066 as nil")
	}
	.PutID(AccountUpdateBusinessWorkHoursRequestTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *AccountUpdateBusinessWorkHoursRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode account.updateBusinessWorkHours#4b00e066 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode account.updateBusinessWorkHours#4b00e066: field flags: %w", )
	}
	if .Flags.Has(0) {
		if  := .BusinessWorkHours.Encode();  != nil {
			return fmt.Errorf("unable to encode account.updateBusinessWorkHours#4b00e066: field business_work_hours: %w", )
		}
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *AccountUpdateBusinessWorkHoursRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.updateBusinessWorkHours#4b00e066 to nil")
	}
	if  := .ConsumeID(AccountUpdateBusinessWorkHoursRequestTypeID);  != nil {
		return fmt.Errorf("unable to decode account.updateBusinessWorkHours#4b00e066: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *AccountUpdateBusinessWorkHoursRequest) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode account.updateBusinessWorkHours#4b00e066 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode account.updateBusinessWorkHours#4b00e066: field flags: %w", )
		}
	}
	if .Flags.Has(0) {
		if  := .BusinessWorkHours.Decode();  != nil {
			return fmt.Errorf("unable to decode account.updateBusinessWorkHours#4b00e066: field business_work_hours: %w", )
		}
	}
	return nil
}

// SetBusinessWorkHours sets value of BusinessWorkHours conditional field.
func ( *AccountUpdateBusinessWorkHoursRequest) ( BusinessWorkHours) {
	.Flags.Set(0)
	.BusinessWorkHours = 
}

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

// AccountUpdateBusinessWorkHours invokes method account.updateBusinessWorkHours#4b00e066 returning error if any.
// Specify a set of Telegram Business opening hours¹.
// This info will be contained in userFull².business_work_hours.
// To remove all opening hours, invoke the method without setting the business_work_hours
// field.
// Note that the opening hours specified by the user must be appropriately validated and
// transformed before invoking the method, as specified here »¹.
//
// Links:
//  1. https://core.telegram.org/api/business#opening-hours
//  2. https://core.telegram.org/constructor/userFull
//  3. https://core.telegram.org/api/business#opening-hours
//
// Possible errors:
//
//	400 BUSINESS_WORK_HOURS_EMPTY: No work hours were specified.
//	400 BUSINESS_WORK_HOURS_PERIOD_INVALID: The specified work hours are invalid, see here » for the exact requirements.
//	400 TIMEZONE_INVALID: The specified timezone does not exist.
//
// See https://core.telegram.org/method/account.updateBusinessWorkHours for reference.
func ( *Client) ( context.Context,  *AccountUpdateBusinessWorkHoursRequest) (bool, error) {
	var  BoolBox

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