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

// BusinessGreetingMessage represents TL type `businessGreetingMessage#e519abab`.
// Describes a Telegram Business greeting¹, automatically sent to new users writing to
// us in private for the first time, or after a certain inactivity period.
//
// Links:
//  1. https://core.telegram.org/api/business#greeting-messages
//
// See https://core.telegram.org/constructor/businessGreetingMessage for reference.
type BusinessGreetingMessage struct {
	// ID of a quick reply shorcut, containing the greeting messages to send, see here » for
	// more info¹.
	//
	// Links:
	//  1) https://core.telegram.org/api/business#quick-reply-shortcuts
	ShortcutID int
	// Allowed recipients for the greeting messages.
	Recipients BusinessRecipients
	// The number of days after which a private chat will be considered as inactive;
	// currently, must be one of 7, 14, 21, or 28.
	NoActivityDays int
}

// BusinessGreetingMessageTypeID is TL type id of BusinessGreetingMessage.
const BusinessGreetingMessageTypeID = 0xe519abab

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

func ( *BusinessGreetingMessage) () bool {
	if  == nil {
		return true
	}
	if !(.ShortcutID == 0) {
		return false
	}
	if !(.Recipients.Zero()) {
		return false
	}
	if !(.NoActivityDays == 0) {
		return false
	}

	return true
}

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

// FillFrom fills BusinessGreetingMessage from given interface.
func ( *BusinessGreetingMessage) ( interface {
	() ( int)
	() ( BusinessRecipients)
	() ( int)
}) {
	.ShortcutID = .()
	.Recipients = .()
	.NoActivityDays = .()
}

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

// TypeName returns name of type in TL schema.
func (*BusinessGreetingMessage) () string {
	return "businessGreetingMessage"
}

// TypeInfo returns info about TL type.
func ( *BusinessGreetingMessage) () tdp.Type {
	 := tdp.Type{
		Name: "businessGreetingMessage",
		ID:   BusinessGreetingMessageTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ShortcutID",
			SchemaName: "shortcut_id",
		},
		{
			Name:       "Recipients",
			SchemaName: "recipients",
		},
		{
			Name:       "NoActivityDays",
			SchemaName: "no_activity_days",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *BusinessGreetingMessage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode businessGreetingMessage#e519abab as nil")
	}
	.PutID(BusinessGreetingMessageTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *BusinessGreetingMessage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode businessGreetingMessage#e519abab as nil")
	}
	.PutInt(.ShortcutID)
	if  := .Recipients.Encode();  != nil {
		return fmt.Errorf("unable to encode businessGreetingMessage#e519abab: field recipients: %w", )
	}
	.PutInt(.NoActivityDays)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *BusinessGreetingMessage) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode businessGreetingMessage#e519abab to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode businessGreetingMessage#e519abab: field shortcut_id: %w", )
		}
		.ShortcutID = 
	}
	{
		if  := .Recipients.Decode();  != nil {
			return fmt.Errorf("unable to decode businessGreetingMessage#e519abab: field recipients: %w", )
		}
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode businessGreetingMessage#e519abab: field no_activity_days: %w", )
		}
		.NoActivityDays = 
	}
	return nil
}

// GetShortcutID returns value of ShortcutID field.
func ( *BusinessGreetingMessage) () ( int) {
	if  == nil {
		return
	}
	return .ShortcutID
}

// GetRecipients returns value of Recipients field.
func ( *BusinessGreetingMessage) () ( BusinessRecipients) {
	if  == nil {
		return
	}
	return .Recipients
}

// GetNoActivityDays returns value of NoActivityDays field.
func ( *BusinessGreetingMessage) () ( int) {
	if  == nil {
		return
	}
	return .NoActivityDays
}