/*
Copyright 2025 The Volcano Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package nodegroup

import "volcano.sh/volcano/pkg/scheduler/api"

const (
	// errNodeGroupAffinityNotFound is returned when the queue group affinity is not specified.
	errNodeGroupAffinityNotFound = "node group affinity not specified"
	// errNodeGroupLabelNotFound is returned when the node group label is not found.
	errNodeGroupLabelNotFound = "node group label not found"
	// errNodeUnsatisfied is returned when the node does not satisfy the node group affinity.
	errNodeUnsatisfied = "node does not satisfy the node group affinity"
	// errNodeGroupResourceLimitInvalid is returned when queue nodegroup resource limit annotation is invalid.
	errNodeGroupResourceLimitInvalid = "node group resource limit annotation invalid"
	// errNodeGroupResourceLimitExceeded is returned when the queue exceeds the nodegroup resource limit.
	errNodeGroupResourceLimitExceeded = "node group resource limit exceeded"
)

func newFitErr(task *api.TaskInfo, node *api.NodeInfo, reason string) error {
	status := &api.Status{
		Code:   api.UnschedulableAndUnresolvable,
		Reason: reason,
	}
	return api.NewFitErrWithStatus(task, node, status)
}
