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

// SMSJobsEligibleToJoin represents TL type `smsjobs.eligibleToJoin#dc8b44cf`.
// SMS jobs eligibility
//
// See https://core.telegram.org/constructor/smsjobs.eligibleToJoin for reference.
type SMSJobsEligibleToJoin struct {
	// Terms of service URL
	TermsURL string
	// Monthly sent SMSes
	MonthlySentSMS int
}

// SMSJobsEligibleToJoinTypeID is TL type id of SMSJobsEligibleToJoin.
const SMSJobsEligibleToJoinTypeID = 0xdc8b44cf

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

func ( *SMSJobsEligibleToJoin) () bool {
	if  == nil {
		return true
	}
	if !(.TermsURL == "") {
		return false
	}
	if !(.MonthlySentSMS == 0) {
		return false
	}

	return true
}

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

// FillFrom fills SMSJobsEligibleToJoin from given interface.
func ( *SMSJobsEligibleToJoin) ( interface {
	() ( string)
	() ( int)
}) {
	.TermsURL = .()
	.MonthlySentSMS = .()
}

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

// TypeName returns name of type in TL schema.
func (*SMSJobsEligibleToJoin) () string {
	return "smsjobs.eligibleToJoin"
}

// TypeInfo returns info about TL type.
func ( *SMSJobsEligibleToJoin) () tdp.Type {
	 := tdp.Type{
		Name: "smsjobs.eligibleToJoin",
		ID:   SMSJobsEligibleToJoinTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "TermsURL",
			SchemaName: "terms_url",
		},
		{
			Name:       "MonthlySentSMS",
			SchemaName: "monthly_sent_sms",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *SMSJobsEligibleToJoin) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode smsjobs.eligibleToJoin#dc8b44cf as nil")
	}
	.PutID(SMSJobsEligibleToJoinTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *SMSJobsEligibleToJoin) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode smsjobs.eligibleToJoin#dc8b44cf as nil")
	}
	.PutString(.TermsURL)
	.PutInt(.MonthlySentSMS)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *SMSJobsEligibleToJoin) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode smsjobs.eligibleToJoin#dc8b44cf to nil")
	}
	{
		,  := .String()
		if  != nil {
			return fmt.Errorf("unable to decode smsjobs.eligibleToJoin#dc8b44cf: field terms_url: %w", )
		}
		.TermsURL = 
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode smsjobs.eligibleToJoin#dc8b44cf: field monthly_sent_sms: %w", )
		}
		.MonthlySentSMS = 
	}
	return nil
}

// GetTermsURL returns value of TermsURL field.
func ( *SMSJobsEligibleToJoin) () ( string) {
	if  == nil {
		return
	}
	return .TermsURL
}

// GetMonthlySentSMS returns value of MonthlySentSMS field.
func ( *SMSJobsEligibleToJoin) () ( int) {
	if  == nil {
		return
	}
	return .MonthlySentSMS
}