// Code generated by node-gen. DO NOT EDIT.
// SPDX-License-Identifier: AGPL-3.0-only

package rangevectorsplitting

import (
	"fmt"

	"github.com/grafana/mimir/pkg/streamingpromql/planning"
	"github.com/grafana/mimir/pkg/streamingpromql/planning/core"
)

func (s *SplitFunctionCall) Child(idx int) planning.Node {
	if idx != 0 {
		panic(fmt.Sprintf("node of type SplitFunctionCall supports 1 child, but attempted to get child at index %d", idx))
	}
	return s.Inner
}

func (s *SplitFunctionCall) ChildCount() int {
	return 1
}

func (s *SplitFunctionCall) SetChildren(children []planning.Node) error {
	if len(children) != 1 {
		return fmt.Errorf("node of type SplitFunctionCall expects one child, but got %d", len(children))
	}
	child0, ok := children[0].(*core.FunctionCall)
	if !ok {
		return fmt.Errorf("node of type SplitFunctionCall expects child Inner to be of type *core.FunctionCall, but got %T", children[0])
	}
	s.Inner = child0
	return nil
}

func (s *SplitFunctionCall) ReplaceChild(idx int, node planning.Node) error {
	if idx != 0 {
		return fmt.Errorf("node of type SplitFunctionCall supports 1 child, but attempted to replace child at index %d", idx)
	}
	child, ok := node.(*core.FunctionCall)
	if !ok {
		return fmt.Errorf("node of type SplitFunctionCall expects child Inner to be of type *core.FunctionCall, but got %T", node)
	}
	s.Inner = child
	return nil
}

func (s *SplitFunctionCall) ChildrenLabels() []string {
	return []string{""}
}

func (s *SplitFunctionCall) EquivalentToIgnoringHintsAndChildren(other planning.Node) bool {
	_, ok := other.(*SplitFunctionCall)
	return ok
}
