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

// MessagesMessageEditData represents TL type `messages.messageEditData#26b5dde6`.
// Message edit data for media
//
// See https://core.telegram.org/constructor/messages.messageEditData for reference.
type MessagesMessageEditData struct {
	// Flags, see TL conditional fieldsĀ¹
	//
	// Links:
	//  1) https://core.telegram.org/mtproto/TL-combinators#conditional-fields
	Flags bin.Fields
	// Media caption, if the specified media's caption can be edited
	Caption bool
}

// MessagesMessageEditDataTypeID is TL type id of MessagesMessageEditData.
const MessagesMessageEditDataTypeID = 0x26b5dde6

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

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

	return true
}

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

// FillFrom fills MessagesMessageEditData from given interface.
func ( *MessagesMessageEditData) ( interface {
	() ( bool)
}) {
	.Caption = .()
}

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

// TypeName returns name of type in TL schema.
func (*MessagesMessageEditData) () string {
	return "messages.messageEditData"
}

// TypeInfo returns info about TL type.
func ( *MessagesMessageEditData) () tdp.Type {
	 := tdp.Type{
		Name: "messages.messageEditData",
		ID:   MessagesMessageEditDataTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "Caption",
			SchemaName: "caption",
			Null:       !.Flags.Has(0),
		},
	}
	return 
}

// SetFlags sets flags for non-zero fields.
func ( *MessagesMessageEditData) () {
	if !(.Caption == false) {
		.Flags.Set(0)
	}
}

// Encode implements bin.Encoder.
func ( *MessagesMessageEditData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.messageEditData#26b5dde6 as nil")
	}
	.PutID(MessagesMessageEditDataTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MessagesMessageEditData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode messages.messageEditData#26b5dde6 as nil")
	}
	.SetFlags()
	if  := .Flags.Encode();  != nil {
		return fmt.Errorf("unable to encode messages.messageEditData#26b5dde6: field flags: %w", )
	}
	return nil
}

// Decode implements bin.Decoder.
func ( *MessagesMessageEditData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.messageEditData#26b5dde6 to nil")
	}
	if  := .ConsumeID(MessagesMessageEditDataTypeID);  != nil {
		return fmt.Errorf("unable to decode messages.messageEditData#26b5dde6: %w", )
	}
	return .DecodeBare()
}

// DecodeBare implements bin.BareDecoder.
func ( *MessagesMessageEditData) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode messages.messageEditData#26b5dde6 to nil")
	}
	{
		if  := .Flags.Decode();  != nil {
			return fmt.Errorf("unable to decode messages.messageEditData#26b5dde6: field flags: %w", )
		}
	}
	.Caption = .Flags.Has(0)
	return nil
}

// SetCaption sets value of Caption conditional field.
func ( *MessagesMessageEditData) ( bool) {
	if  {
		.Flags.Set(0)
		.Caption = true
	} else {
		.Flags.Unset(0)
		.Caption = false
	}
}

// GetCaption returns value of Caption conditional field.
func ( *MessagesMessageEditData) () ( bool) {
	if  == nil {
		return
	}
	return .Flags.Has(0)
}