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

// PhotoSizeEmpty represents TL type `photoSizeEmpty#e17e23c`.
// Empty constructor. Image with this thumbnail is unavailable.
//
// See https://core.telegram.org/constructor/photoSizeEmpty for reference.
type PhotoSizeEmpty struct {
	// Thumbnail type »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/files#image-thumbnail-types
	Type string
}

// PhotoSizeEmptyTypeID is TL type id of PhotoSizeEmpty.
const PhotoSizeEmptyTypeID = 0xe17e23c

// construct implements constructor of PhotoSizeClass.
func ( PhotoSizeEmpty) () PhotoSizeClass { return & }

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

	_ PhotoSizeClass = &PhotoSizeEmpty{}
)

func ( *PhotoSizeEmpty) () bool {
	if  == nil {
		return true
	}
	if !(.Type == "") {
		return false
	}

	return true
}

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

// FillFrom fills PhotoSizeEmpty from given interface.
func ( *PhotoSizeEmpty) ( interface {
	() ( string)
}) {
	.Type = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhotoSizeEmpty) () tdp.Type {
	 := tdp.Type{
		Name: "photoSizeEmpty",
		ID:   PhotoSizeEmptyTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Type",
			SchemaName: "type",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhotoSizeEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoSizeEmpty#e17e23c as nil")
	}
	.PutID(PhotoSizeEmptyTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhotoSizeEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoSizeEmpty#e17e23c as nil")
	}
	.PutString(.Type)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhotoSizeEmpty) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode photoSizeEmpty#e17e23c to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode photoSizeEmpty#e17e23c: field type: %w", )
		}
		.Type = 
	}
	return nil
}

// GetType returns value of Type field.
func ( *PhotoSizeEmpty) () ( string) {
	if  == nil {
		return
	}
	return .Type
}

// PhotoSize represents TL type `photoSize#75c78e60`.
// Image description.
//
// See https://core.telegram.org/constructor/photoSize for reference.
type PhotoSize struct {
	// Thumbnail type »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/files#image-thumbnail-types
	Type string
	// Image width
	W int
	// Image height
	H int
	// File size
	Size int
}

// PhotoSizeTypeID is TL type id of PhotoSize.
const PhotoSizeTypeID = 0x75c78e60

// construct implements constructor of PhotoSizeClass.
func ( PhotoSize) () PhotoSizeClass { return & }

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

	_ PhotoSizeClass = &PhotoSize{}
)

func ( *PhotoSize) () bool {
	if  == nil {
		return true
	}
	if !(.Type == "") {
		return false
	}
	if !(.W == 0) {
		return false
	}
	if !(.H == 0) {
		return false
	}
	if !(.Size == 0) {
		return false
	}

	return true
}

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

// FillFrom fills PhotoSize from given interface.
func ( *PhotoSize) ( interface {
	() ( string)
	() ( int)
	() ( int)
	() ( int)
}) {
	.Type = .()
	.W = .()
	.H = .()
	.Size = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhotoSize) () tdp.Type {
	 := tdp.Type{
		Name: "photoSize",
		ID:   PhotoSizeTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Type",
			SchemaName: "type",
		},
		{
			Name:       "W",
			SchemaName: "w",
		},
		{
			Name:       "H",
			SchemaName: "h",
		},
		{
			Name:       "Size",
			SchemaName: "size",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhotoSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoSize#75c78e60 as nil")
	}
	.PutID(PhotoSizeTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhotoSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoSize#75c78e60 as nil")
	}
	.PutString(.Type)
	.PutInt(.W)
	.PutInt(.H)
	.PutInt(.Size)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhotoSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode photoSize#75c78e60 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode photoSize#75c78e60: field type: %w", )
		}
		.Type = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode photoSize#75c78e60: field w: %w", )
		}
		.W = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode photoSize#75c78e60: field h: %w", )
		}
		.H = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode photoSize#75c78e60: field size: %w", )
		}
		.Size = 
	}
	return nil
}

// GetType returns value of Type field.
func ( *PhotoSize) () ( string) {
	if  == nil {
		return
	}
	return .Type
}

// GetW returns value of W field.
func ( *PhotoSize) () ( int) {
	if  == nil {
		return
	}
	return .W
}

// GetH returns value of H field.
func ( *PhotoSize) () ( int) {
	if  == nil {
		return
	}
	return .H
}

// GetSize returns value of Size field.
func ( *PhotoSize) () ( int) {
	if  == nil {
		return
	}
	return .Size
}

// PhotoCachedSize represents TL type `photoCachedSize#21e1ad6`.
// Description of an image and its content.
//
// See https://core.telegram.org/constructor/photoCachedSize for reference.
type PhotoCachedSize struct {
	// Thumbnail type
	Type string
	// Image width
	W int
	// Image height
	H int
	// Binary data, file content
	Bytes []byte
}

// PhotoCachedSizeTypeID is TL type id of PhotoCachedSize.
const PhotoCachedSizeTypeID = 0x21e1ad6

// construct implements constructor of PhotoSizeClass.
func ( PhotoCachedSize) () PhotoSizeClass { return & }

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

	_ PhotoSizeClass = &PhotoCachedSize{}
)

func ( *PhotoCachedSize) () bool {
	if  == nil {
		return true
	}
	if !(.Type == "") {
		return false
	}
	if !(.W == 0) {
		return false
	}
	if !(.H == 0) {
		return false
	}
	if !(.Bytes == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PhotoCachedSize from given interface.
func ( *PhotoCachedSize) ( interface {
	() ( string)
	() ( int)
	() ( int)
	() ( []byte)
}) {
	.Type = .()
	.W = .()
	.H = .()
	.Bytes = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhotoCachedSize) () tdp.Type {
	 := tdp.Type{
		Name: "photoCachedSize",
		ID:   PhotoCachedSizeTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Type",
			SchemaName: "type",
		},
		{
			Name:       "W",
			SchemaName: "w",
		},
		{
			Name:       "H",
			SchemaName: "h",
		},
		{
			Name:       "Bytes",
			SchemaName: "bytes",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhotoCachedSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoCachedSize#21e1ad6 as nil")
	}
	.PutID(PhotoCachedSizeTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhotoCachedSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoCachedSize#21e1ad6 as nil")
	}
	.PutString(.Type)
	.PutInt(.W)
	.PutInt(.H)
	.PutBytes(.Bytes)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhotoCachedSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode photoCachedSize#21e1ad6 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode photoCachedSize#21e1ad6: field type: %w", )
		}
		.Type = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode photoCachedSize#21e1ad6: field w: %w", )
		}
		.W = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode photoCachedSize#21e1ad6: field h: %w", )
		}
		.H = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode photoCachedSize#21e1ad6: field bytes: %w", )
		}
		.Bytes = 
	}
	return nil
}

// GetType returns value of Type field.
func ( *PhotoCachedSize) () ( string) {
	if  == nil {
		return
	}
	return .Type
}

// GetW returns value of W field.
func ( *PhotoCachedSize) () ( int) {
	if  == nil {
		return
	}
	return .W
}

// GetH returns value of H field.
func ( *PhotoCachedSize) () ( int) {
	if  == nil {
		return
	}
	return .H
}

// GetBytes returns value of Bytes field.
func ( *PhotoCachedSize) () ( []byte) {
	if  == nil {
		return
	}
	return .Bytes
}

// PhotoStrippedSize represents TL type `photoStrippedSize#e0b0bc2e`.
// A low-resolution compressed JPG payload
//
// See https://core.telegram.org/constructor/photoStrippedSize for reference.
type PhotoStrippedSize struct {
	// Thumbnail type
	Type string
	// Thumbnail data, see here for more info on decompression »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/files#stripped-thumbnails
	Bytes []byte
}

// PhotoStrippedSizeTypeID is TL type id of PhotoStrippedSize.
const PhotoStrippedSizeTypeID = 0xe0b0bc2e

// construct implements constructor of PhotoSizeClass.
func ( PhotoStrippedSize) () PhotoSizeClass { return & }

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

	_ PhotoSizeClass = &PhotoStrippedSize{}
)

func ( *PhotoStrippedSize) () bool {
	if  == nil {
		return true
	}
	if !(.Type == "") {
		return false
	}
	if !(.Bytes == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PhotoStrippedSize from given interface.
func ( *PhotoStrippedSize) ( interface {
	() ( string)
	() ( []byte)
}) {
	.Type = .()
	.Bytes = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhotoStrippedSize) () tdp.Type {
	 := tdp.Type{
		Name: "photoStrippedSize",
		ID:   PhotoStrippedSizeTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Type",
			SchemaName: "type",
		},
		{
			Name:       "Bytes",
			SchemaName: "bytes",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhotoStrippedSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoStrippedSize#e0b0bc2e as nil")
	}
	.PutID(PhotoStrippedSizeTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhotoStrippedSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoStrippedSize#e0b0bc2e as nil")
	}
	.PutString(.Type)
	.PutBytes(.Bytes)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhotoStrippedSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode photoStrippedSize#e0b0bc2e to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode photoStrippedSize#e0b0bc2e: field type: %w", )
		}
		.Type = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode photoStrippedSize#e0b0bc2e: field bytes: %w", )
		}
		.Bytes = 
	}
	return nil
}

// GetType returns value of Type field.
func ( *PhotoStrippedSize) () ( string) {
	if  == nil {
		return
	}
	return .Type
}

// GetBytes returns value of Bytes field.
func ( *PhotoStrippedSize) () ( []byte) {
	if  == nil {
		return
	}
	return .Bytes
}

// PhotoSizeProgressive represents TL type `photoSizeProgressive#fa3efb95`.
// Progressively encoded photosize
//
// See https://core.telegram.org/constructor/photoSizeProgressive for reference.
type PhotoSizeProgressive struct {
	// Photosize type »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/files#image-thumbnail-types
	Type string
	// Photo width
	W int
	// Photo height
	H int
	// Sizes of progressive JPEG file prefixes, which can be used to preliminarily show the
	// image.
	Sizes []int
}

// PhotoSizeProgressiveTypeID is TL type id of PhotoSizeProgressive.
const PhotoSizeProgressiveTypeID = 0xfa3efb95

// construct implements constructor of PhotoSizeClass.
func ( PhotoSizeProgressive) () PhotoSizeClass { return & }

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

	_ PhotoSizeClass = &PhotoSizeProgressive{}
)

func ( *PhotoSizeProgressive) () bool {
	if  == nil {
		return true
	}
	if !(.Type == "") {
		return false
	}
	if !(.W == 0) {
		return false
	}
	if !(.H == 0) {
		return false
	}
	if !(.Sizes == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PhotoSizeProgressive from given interface.
func ( *PhotoSizeProgressive) ( interface {
	() ( string)
	() ( int)
	() ( int)
	() ( []int)
}) {
	.Type = .()
	.W = .()
	.H = .()
	.Sizes = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhotoSizeProgressive) () tdp.Type {
	 := tdp.Type{
		Name: "photoSizeProgressive",
		ID:   PhotoSizeProgressiveTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Type",
			SchemaName: "type",
		},
		{
			Name:       "W",
			SchemaName: "w",
		},
		{
			Name:       "H",
			SchemaName: "h",
		},
		{
			Name:       "Sizes",
			SchemaName: "sizes",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhotoSizeProgressive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoSizeProgressive#fa3efb95 as nil")
	}
	.PutID(PhotoSizeProgressiveTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhotoSizeProgressive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoSizeProgressive#fa3efb95 as nil")
	}
	.PutString(.Type)
	.PutInt(.W)
	.PutInt(.H)
	.PutVectorHeader(len(.Sizes))
	for ,  := range .Sizes {
		.PutInt()
	}
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhotoSizeProgressive) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode photoSizeProgressive#fa3efb95 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode photoSizeProgressive#fa3efb95: field type: %w", )
		}
		.Type = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode photoSizeProgressive#fa3efb95: field w: %w", )
		}
		.W = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode photoSizeProgressive#fa3efb95: field h: %w", )
		}
		.H = 
	}
	{
		,  := .VectorHeader()
		if  != nil {
			return fmt.Errorf("unable to decode photoSizeProgressive#fa3efb95: field sizes: %w", )
		}

		if  > 0 {
			.Sizes = make([]int, 0, %bin.PreallocateLimit)
		}
		for  := 0;  < ; ++ {
			,  := .Int()
			if  != nil {
				return fmt.Errorf("unable to decode photoSizeProgressive#fa3efb95: field sizes: %w", )
			}
			.Sizes = append(.Sizes, )
		}
	}
	return nil
}

// GetType returns value of Type field.
func ( *PhotoSizeProgressive) () ( string) {
	if  == nil {
		return
	}
	return .Type
}

// GetW returns value of W field.
func ( *PhotoSizeProgressive) () ( int) {
	if  == nil {
		return
	}
	return .W
}

// GetH returns value of H field.
func ( *PhotoSizeProgressive) () ( int) {
	if  == nil {
		return
	}
	return .H
}

// GetSizes returns value of Sizes field.
func ( *PhotoSizeProgressive) () ( []int) {
	if  == nil {
		return
	}
	return .Sizes
}

// PhotoPathSize represents TL type `photoPathSize#d8214d41`.
// Messages with animated stickers can have a compressed svg (< 300 bytes) to show the
// outline of the sticker before fetching the actual lottie animation.
//
// See https://core.telegram.org/constructor/photoPathSize for reference.
type PhotoPathSize struct {
	// Always j
	Type string
	// Compressed SVG path payload, see here for decompression instructions¹
	//
	// Links:
	//  1) https://core.telegram.org/api/files#vector-thumbnails
	Bytes []byte
}

// PhotoPathSizeTypeID is TL type id of PhotoPathSize.
const PhotoPathSizeTypeID = 0xd8214d41

// construct implements constructor of PhotoSizeClass.
func ( PhotoPathSize) () PhotoSizeClass { return & }

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

	_ PhotoSizeClass = &PhotoPathSize{}
)

func ( *PhotoPathSize) () bool {
	if  == nil {
		return true
	}
	if !(.Type == "") {
		return false
	}
	if !(.Bytes == nil) {
		return false
	}

	return true
}

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

// FillFrom fills PhotoPathSize from given interface.
func ( *PhotoPathSize) ( interface {
	() ( string)
	() ( []byte)
}) {
	.Type = .()
	.Bytes = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *PhotoPathSize) () tdp.Type {
	 := tdp.Type{
		Name: "photoPathSize",
		ID:   PhotoPathSizeTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Type",
			SchemaName: "type",
		},
		{
			Name:       "Bytes",
			SchemaName: "bytes",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *PhotoPathSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoPathSize#d8214d41 as nil")
	}
	.PutID(PhotoPathSizeTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *PhotoPathSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode photoPathSize#d8214d41 as nil")
	}
	.PutString(.Type)
	.PutBytes(.Bytes)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *PhotoPathSize) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode photoPathSize#d8214d41 to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode photoPathSize#d8214d41: field type: %w", )
		}
		.Type = 
	}
	{
		,  := .Bytes()
		if  != nil {
			return fmt.Errorf("unable to decode photoPathSize#d8214d41: field bytes: %w", )
		}
		.Bytes = 
	}
	return nil
}

// GetType returns value of Type field.
func ( *PhotoPathSize) () ( string) {
	if  == nil {
		return
	}
	return .Type
}

// GetBytes returns value of Bytes field.
func ( *PhotoPathSize) () ( []byte) {
	if  == nil {
		return
	}
	return .Bytes
}

// PhotoSizeClassName is schema name of PhotoSizeClass.
const PhotoSizeClassName = "PhotoSize"

// PhotoSizeClass represents PhotoSize generic type.
//
// See https://core.telegram.org/type/PhotoSize for reference.
//
// Example:
//
//	g, err := tg.DecodePhotoSize(buf)
//	if err != nil {
//	    panic(err)
//	}
//	switch v := g.(type) {
//	case *tg.PhotoSizeEmpty: // photoSizeEmpty#e17e23c
//	case *tg.PhotoSize: // photoSize#75c78e60
//	case *tg.PhotoCachedSize: // photoCachedSize#21e1ad6
//	case *tg.PhotoStrippedSize: // photoStrippedSize#e0b0bc2e
//	case *tg.PhotoSizeProgressive: // photoSizeProgressive#fa3efb95
//	case *tg.PhotoPathSize: // photoPathSize#d8214d41
//	default: panic(v)
//	}
type PhotoSizeClass interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() PhotoSizeClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool

	// Thumbnail type »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/files#image-thumbnail-types
	GetType() (value string)

	// AsNotEmpty tries to map PhotoSizeClass to NotEmptyPhotoSize.
	AsNotEmpty() (NotEmptyPhotoSize, bool)
}

// NotEmptyPhotoSize represents NotEmpty subset of PhotoSizeClass.
type NotEmptyPhotoSize interface {
	bin.Encoder
	bin.Decoder
	bin.BareEncoder
	bin.BareDecoder
	construct() PhotoSizeClass

	// TypeID returns type id in TL schema.
	//
	// See https://core.telegram.org/mtproto/TL-tl#remarks.
	TypeID() uint32
	// TypeName returns name of type in TL schema.
	TypeName() string
	// String implements fmt.Stringer.
	String() string
	// Zero returns true if current object has a zero value.
	Zero() bool

	// Thumbnail type »¹
	//
	// Links:
	//  1) https://core.telegram.org/api/files#image-thumbnail-types
	GetType() (value string)
}

// AsNotEmpty tries to map PhotoSizeEmpty to NotEmptyPhotoSize.
func ( *PhotoSizeEmpty) () (NotEmptyPhotoSize, bool) {
	,  := (PhotoSizeClass()).(NotEmptyPhotoSize)
	return , 
}

// AsNotEmpty tries to map PhotoSize to NotEmptyPhotoSize.
func ( *PhotoSize) () (NotEmptyPhotoSize, bool) {
	,  := (PhotoSizeClass()).(NotEmptyPhotoSize)
	return , 
}

// AsNotEmpty tries to map PhotoCachedSize to NotEmptyPhotoSize.
func ( *PhotoCachedSize) () (NotEmptyPhotoSize, bool) {
	,  := (PhotoSizeClass()).(NotEmptyPhotoSize)
	return , 
}

// AsNotEmpty tries to map PhotoStrippedSize to NotEmptyPhotoSize.
func ( *PhotoStrippedSize) () (NotEmptyPhotoSize, bool) {
	,  := (PhotoSizeClass()).(NotEmptyPhotoSize)
	return , 
}

// AsNotEmpty tries to map PhotoSizeProgressive to NotEmptyPhotoSize.
func ( *PhotoSizeProgressive) () (NotEmptyPhotoSize, bool) {
	,  := (PhotoSizeClass()).(NotEmptyPhotoSize)
	return , 
}

// AsNotEmpty tries to map PhotoPathSize to NotEmptyPhotoSize.
func ( *PhotoPathSize) () (NotEmptyPhotoSize, bool) {
	,  := (PhotoSizeClass()).(NotEmptyPhotoSize)
	return , 
}

// DecodePhotoSize implements binary de-serialization for PhotoSizeClass.
func ( *bin.Buffer) (PhotoSizeClass, error) {
	,  := .PeekID()
	if  != nil {
		return nil, 
	}
	switch  {
	case PhotoSizeEmptyTypeID:
		// Decoding photoSizeEmpty#e17e23c.
		 := PhotoSizeEmpty{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", )
		}
		return &, nil
	case PhotoSizeTypeID:
		// Decoding photoSize#75c78e60.
		 := PhotoSize{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", )
		}
		return &, nil
	case PhotoCachedSizeTypeID:
		// Decoding photoCachedSize#21e1ad6.
		 := PhotoCachedSize{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", )
		}
		return &, nil
	case PhotoStrippedSizeTypeID:
		// Decoding photoStrippedSize#e0b0bc2e.
		 := PhotoStrippedSize{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", )
		}
		return &, nil
	case PhotoSizeProgressiveTypeID:
		// Decoding photoSizeProgressive#fa3efb95.
		 := PhotoSizeProgressive{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", )
		}
		return &, nil
	case PhotoPathSizeTypeID:
		// Decoding photoPathSize#d8214d41.
		 := PhotoPathSize{}
		if  := .Decode();  != nil {
			return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", )
		}
		return &, nil
	default:
		return nil, fmt.Errorf("unable to decode PhotoSizeClass: %w", bin.NewUnexpectedID())
	}
}

// PhotoSize boxes the PhotoSizeClass providing a helper.
type PhotoSizeBox struct {
	PhotoSize PhotoSizeClass
}

// Decode implements bin.Decoder for PhotoSizeBox.
func ( *PhotoSizeBox) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("unable to decode PhotoSizeBox to nil")
	}
	,  := DecodePhotoSize()
	if  != nil {
		return fmt.Errorf("unable to decode boxed value: %w", )
	}
	.PhotoSize = 
	return nil
}

// Encode implements bin.Encode for PhotoSizeBox.
func ( *PhotoSizeBox) ( *bin.Buffer) error {
	if  == nil || .PhotoSize == nil {
		return fmt.Errorf("unable to encode PhotoSizeClass as nil")
	}
	return .PhotoSize.Encode()
}