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

// ContactBirthday represents TL type `contactBirthday#1d998733`.
// Birthday information of a contact.
//
// See https://core.telegram.org/constructor/contactBirthday for reference.
type ContactBirthday struct {
	// User ID.
	ContactID int64
	// Birthday information.
	Birthday Birthday
}

// ContactBirthdayTypeID is TL type id of ContactBirthday.
const ContactBirthdayTypeID = 0x1d998733

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

func ( *ContactBirthday) () bool {
	if  == nil {
		return true
	}
	if !(.ContactID == 0) {
		return false
	}
	if !(.Birthday.Zero()) {
		return false
	}

	return true
}

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

// FillFrom fills ContactBirthday from given interface.
func ( *ContactBirthday) ( interface {
	() ( int64)
	() ( Birthday)
}) {
	.ContactID = .()
	.Birthday = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *ContactBirthday) () tdp.Type {
	 := tdp.Type{
		Name: "contactBirthday",
		ID:   ContactBirthdayTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ContactID",
			SchemaName: "contact_id",
		},
		{
			Name:       "Birthday",
			SchemaName: "birthday",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *ContactBirthday) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contactBirthday#1d998733 as nil")
	}
	.PutID(ContactBirthdayTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *ContactBirthday) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode contactBirthday#1d998733 as nil")
	}
	.PutLong(.ContactID)
	if  := .Birthday.Encode();  != nil {
		return fmt.Errorf("unable to encode contactBirthday#1d998733: field birthday: %w", )
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *ContactBirthday) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode contactBirthday#1d998733 to nil")
	}
	{
		,  := .Long()
		if  != nil {
			return fmt.Errorf("unable to decode contactBirthday#1d998733: field contact_id: %w", )
		}
		.ContactID = 
	}
	{
		if  := .Birthday.Decode();  != nil {
			return fmt.Errorf("unable to decode contactBirthday#1d998733: field birthday: %w", )
		}
	}
	return nil
}

// GetContactID returns value of ContactID field.
func ( *ContactBirthday) () ( int64) {
	if  == nil {
		return
	}
	return .ContactID
}

// GetBirthday returns value of Birthday field.
func ( *ContactBirthday) () ( Birthday) {
	if  == nil {
		return
	}
	return .Birthday
}