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

// StatsDateRangeDays represents TL type `statsDateRangeDays#b637edaf`.
// Channel statisticsĀ¹ date range
//
// Links:
//  1. https://core.telegram.org/api/stats
//
// See https://core.telegram.org/constructor/statsDateRangeDays for reference.
type StatsDateRangeDays struct {
	// Initial date
	MinDate int
	// Final date
	MaxDate int
}

// StatsDateRangeDaysTypeID is TL type id of StatsDateRangeDays.
const StatsDateRangeDaysTypeID = 0xb637edaf

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

func ( *StatsDateRangeDays) () bool {
	if  == nil {
		return true
	}
	if !(.MinDate == 0) {
		return false
	}
	if !(.MaxDate == 0) {
		return false
	}

	return true
}

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

// FillFrom fills StatsDateRangeDays from given interface.
func ( *StatsDateRangeDays) ( interface {
	() ( int)
	() ( int)
}) {
	.MinDate = .()
	.MaxDate = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *StatsDateRangeDays) () tdp.Type {
	 := tdp.Type{
		Name: "statsDateRangeDays",
		ID:   StatsDateRangeDaysTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "MinDate",
			SchemaName: "min_date",
		},
		{
			Name:       "MaxDate",
			SchemaName: "max_date",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *StatsDateRangeDays) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode statsDateRangeDays#b637edaf as nil")
	}
	.PutID(StatsDateRangeDaysTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *StatsDateRangeDays) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode statsDateRangeDays#b637edaf as nil")
	}
	.PutInt(.MinDate)
	.PutInt(.MaxDate)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *StatsDateRangeDays) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode statsDateRangeDays#b637edaf to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode statsDateRangeDays#b637edaf: field min_date: %w", )
		}
		.MinDate = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode statsDateRangeDays#b637edaf: field max_date: %w", )
		}
		.MaxDate = 
	}
	return nil
}

// GetMinDate returns value of MinDate field.
func ( *StatsDateRangeDays) () ( int) {
	if  == nil {
		return
	}
	return .MinDate
}

// GetMaxDate returns value of MaxDate field.
func ( *StatsDateRangeDays) () ( int) {
	if  == nil {
		return
	}
	return .MaxDate
}