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

// MaskCoords represents TL type `maskCoords#aed6dbb2`.
// Position on a photo where a mask should be placed when attaching stickers to media
// »¹
// The n position indicates where the mask should be placed:
//
// Links:
//  1. https://core.telegram.org/api/stickers#attached-stickers
//
// See https://core.telegram.org/constructor/maskCoords for reference.
type MaskCoords struct {
	// Part of the face, relative to which the mask should be placed
	N int
	// Shift by X-axis measured in widths of the mask scaled to the face size, from left to
	// right. (For example, -1.0 will place the mask just to the left of the default mask
	// position)
	X float64
	// Shift by Y-axis measured in widths of the mask scaled to the face size, from left to
	// right. (For example, -1.0 will place the mask just below the default mask position)
	Y float64
	// Mask scaling coefficient. (For example, 2.0 means a doubled size)
	Zoom float64
}

// MaskCoordsTypeID is TL type id of MaskCoords.
const MaskCoordsTypeID = 0xaed6dbb2

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

func ( *MaskCoords) () bool {
	if  == nil {
		return true
	}
	if !(.N == 0) {
		return false
	}
	if !(.X == 0) {
		return false
	}
	if !(.Y == 0) {
		return false
	}
	if !(.Zoom == 0) {
		return false
	}

	return true
}

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

// FillFrom fills MaskCoords from given interface.
func ( *MaskCoords) ( interface {
	() ( int)
	() ( float64)
	() ( float64)
	() ( float64)
}) {
	.N = .()
	.X = .()
	.Y = .()
	.Zoom = .()
}

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

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

// TypeInfo returns info about TL type.
func ( *MaskCoords) () tdp.Type {
	 := tdp.Type{
		Name: "maskCoords",
		ID:   MaskCoordsTypeID,
	}
	if  == nil {
		.Null = true
		return 
	}
	.Fields = []tdp.Field{
		{
			Name:       "N",
			SchemaName: "n",
		},
		{
			Name:       "X",
			SchemaName: "x",
		},
		{
			Name:       "Y",
			SchemaName: "y",
		},
		{
			Name:       "Zoom",
			SchemaName: "zoom",
		},
	}
	return 
}

// Encode implements bin.Encoder.
func ( *MaskCoords) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode maskCoords#aed6dbb2 as nil")
	}
	.PutID(MaskCoordsTypeID)
	return .EncodeBare()
}

// EncodeBare implements bin.BareEncoder.
func ( *MaskCoords) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't encode maskCoords#aed6dbb2 as nil")
	}
	.PutInt(.N)
	.PutDouble(.X)
	.PutDouble(.Y)
	.PutDouble(.Zoom)
	return nil
}

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

// DecodeBare implements bin.BareDecoder.
func ( *MaskCoords) ( *bin.Buffer) error {
	if  == nil {
		return fmt.Errorf("can't decode maskCoords#aed6dbb2 to nil")
	}
	{
		,  := .Int()
		if  != nil {
			return fmt.Errorf("unable to decode maskCoords#aed6dbb2: field n: %w", )
		}
		.N = 
	}
	{
		,  := .Double()
		if  != nil {
			return fmt.Errorf("unable to decode maskCoords#aed6dbb2: field x: %w", )
		}
		.X = 
	}
	{
		,  := .Double()
		if  != nil {
			return fmt.Errorf("unable to decode maskCoords#aed6dbb2: field y: %w", )
		}
		.Y = 
	}
	{
		,  := .Double()
		if  != nil {
			return fmt.Errorf("unable to decode maskCoords#aed6dbb2: field zoom: %w", )
		}
		.Zoom = 
	}
	return nil
}

// GetN returns value of N field.
func ( *MaskCoords) () ( int) {
	if  == nil {
		return
	}
	return .N
}

// GetX returns value of X field.
func ( *MaskCoords) () ( float64) {
	if  == nil {
		return
	}
	return .X
}

// GetY returns value of Y field.
func ( *MaskCoords) () ( float64) {
	if  == nil {
		return
	}
	return .Y
}

// GetZoom returns value of Zoom field.
func ( *MaskCoords) () ( float64) {
	if  == nil {
		return
	}
	return .Zoom
}