class_name WorkProvider extends Node
## Abstract base for all work-category providers (Construction, Mining,
## Hauling, Cooking, …). Subclass this and override find_best_for().
##
## Pawn AI layer 2: each pawn iterates its ordered list of WorkProviders
## and calls find_best_for(self) until one returns a non-null Job.
##
## `pawn` is intentionally untyped (duck-typed) to avoid class_name
## init-order issues. Concrete providers access pawn.tile, pawn.pawn_name,
## pawn.is_walking(), etc. — the same public API exposed by Pawn.

## Work category key used to identify this provider. Must be unique per
## provider instance; used by the priority matrix and Decision layer.
@export var category: StringName = &"unspecified"

## Priority slot in the pawn's work-priority matrix.
## Higher values are scanned first by the Decision layer.
@export var priority: int = 0


# ── abstract interface ───────────────────────────────────────────────────────

## Concrete providers MUST override this.
## Return a Job for `pawn` to execute, or null if no suitable work exists.
func find_best_for(pawn) -> Job:
	push_error("WorkProvider.find_best_for: subclass '%s' must override this method" % name)
	return null
