package matching import ( "context" "time" "github.com/google/uuid" "github.com/missionworkforce/missionmatch/internal/modules/matching/engine" "github.com/missionworkforce/missionmatch/internal/platform/database/dbgen" ) // This file exports the candidate and requirement load helpers so other modules (the W3 staffing // recommendations module) reuse the EXACT same path the slate loop uses to turn DB rows into the pure // engine inputs. Keeping one load and convert path means a staffing recommendation references the same // frozen score screenMATCH and slateMATCH would compute for the same pair, never a second scoring // implementation. The private loadRequirement and loadCandidate stay the single source; these are thin // exported wrappers. // LoadEngineRequirement loads a requirement and its required skills and certifications into the pure // engine input, scoped to the caller's org by RLS on the supplied querier. func LoadEngineRequirement(ctx context.Context, q dbgen.Querier, reqID uuid.UUID) (engine.Requirement, error) { return loadRequirement(ctx, q, reqID) } // LoadEngineRequirementFromRow turns an already loaded requirement row into the engine input (loads its // required skills and certs). Useful when the caller already has the row, for example from a batched // list query, and wants to avoid a second GetRequirement. func LoadEngineRequirementFromRow(ctx context.Context, q dbgen.Querier, r dbgen.Requirement) (engine.Requirement, error) { return reqFromRow(ctx, q, r) } // LoadEngineCandidate loads a candidate row plus its skills, certifications, and customer experience // into the pure engine input, applying the clearance expiry as of rule. Scoped to the caller's org by // RLS on the supplied querier. func LoadEngineCandidate(ctx context.Context, q dbgen.Querier, c dbgen.Candidate, asOf time.Time) (engine.Candidate, error) { return loadCandidate(ctx, q, c, asOf) }