// Copyright (c) 2024-2026 Celestino Amoroso (celestino.amoroso@gmail.com).
// All rights reserved.

// term.go
package kern

import (
	"fmt"

	"git.portale-stac.it/go-pkg/expr/sym"
)

type Term interface {
	fmt.Stringer
	// Children() []Term
	Source() string
	GetChildCount() (count int)
	GetChild(index int) Term
	GetChildSource(index int) string
	GetLeftChild() (c Term)
	GetRightChild() (c Term)
	Symbol() (symbol sym.Symbol)
	IsSymbol(symbol sym.Symbol) bool
	IsOneOf(symbols ...sym.Symbol) bool
	IsAssign() bool
	IsVar() bool
	SetSymbol(symbol sym.Symbol)
	Compute(ctx ExprContext) (result any, err error)
	EvalInfix(ctx ExprContext) (leftValue, rightValue any, err error)
	Errorf(template string, args ...any) (err error)
	ErrIncompatibleTypes(leftValue, rightValue any) error
}
