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

// Timezone represents TL type `timezone#ff9289f5`.
// Timezone information.
//
// See https://core.telegram.org/constructor/timezone for reference.
type Timezone struct {
	// Unique timezone ID.
	ID string
	// Human-readable and localized timezone name.
	Name string
	// UTC offset in seconds, which may be displayed in hh:mm format by the client together
	// with the human-readable name (i.e. $name UTC -01:00).
	UtcOffset int
}

// TimezoneTypeID is TL type id of Timezone.
const TimezoneTypeID = 0xff9289f5

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

func ( *Timezone) () bool {
	if  == nil {
		return true
	}
	if !(.ID == "") {
		return false
	}
	if !(.Name == "") {
		return false
	}
	if !(.UtcOffset == 0) {
		return false
	}

	return true
}

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

// FillFrom fills Timezone from given interface.
func ( *Timezone) ( interface {
	() ( string)
	() ( string)
	() ( int)
}) {
	.ID = .()
	.Name = .()
	.UtcOffset = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *Timezone) () tdp.Type {
	 := tdp.Type{
		Name: "timezone",
		ID:   TimezoneTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "ID",
			SchemaName: "id",
		},
		{
			Name:       "Name",
			SchemaName: "name",
		},
		{
			Name:       "UtcOffset",
			SchemaName: "utc_offset",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *Timezone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode timezone#ff9289f5 as nil")
	}
	.PutID(TimezoneTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *Timezone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode timezone#ff9289f5 as nil")
	}
	.PutString(.ID)
	.PutString(.Name)
	.PutInt(.UtcOffset)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *Timezone) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode timezone#ff9289f5 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode timezone#ff9289f5: field id: %w", )
		}
		.ID = 
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode timezone#ff9289f5: field name: %w", )
		}
		.Name = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode timezone#ff9289f5: field utc_offset: %w", )
		}
		.UtcOffset = 
	}
	return nil
}

// GetID returns value of ID field.
func ( *Timezone) () ( string) {
	if  == nil {
		return
	}
	return .ID
}

// GetName returns value of Name field.
func ( *Timezone) () ( string) {
	if  == nil {
		return
	}
	return .Name
}

// GetUtcOffset returns value of UtcOffset field.
func ( *Timezone) () ( int) {
	if  == nil {
		return
	}
	return .UtcOffset
}