// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.31.1 package dbgen import ( "context" "github.com/google/uuid" ) type Querier interface { AddCandidateCertification(ctx context.Context, arg AddCandidateCertificationParams) error AddCandidateCustomerExperience(ctx context.Context, arg AddCandidateCustomerExperienceParams) error AddCandidateSkill(ctx context.Context, arg AddCandidateSkillParams) error AddRequiredCertification(ctx context.Context, arg AddRequiredCertificationParams) error AddRequiredSkill(ctx context.Context, arg AddRequiredSkillParams) error AddSlateMember(ctx context.Context, arg AddSlateMemberParams) (SlateMember, error) // Right to erasure as anonymize in place: wipe the identifying PII while KEEPING the row so the de // identified scored outcomes (slate_members) and the demographic bucket survive for the adverse impact // record. Once the name, email, contact, and resume vector are gone the row is no longer personal data, // so erasure is satisfied and the compliance history is preserved. Idempotent on anonymized_at. AnonymizeCandidate(ctx context.Context, id uuid.UUID) (int64, error) AwardsSyncMeta(ctx context.Context) (AwardsSyncMetaRow, error) CreateCandidate(ctx context.Context, arg CreateCandidateParams) (Candidate, error) CreateOpportunity(ctx context.Context, arg CreateOpportunityParams) (Opportunity, error) // W3 AI Staffing Recommendations queries. Reads are RLS scoped by the app.current_org_id policy, so a // bare SELECT only ever sees the caller's org; writes pass organization_id explicitly and the RLS WITH // CHECK validates it matches the session org. No query here names the eeo schema, and none can: the // generated code is built only from public schema queries. CreateRecommendationRun(ctx context.Context, arg CreateRecommendationRunParams) (RecommendationRun, error) CreateRequirement(ctx context.Context, arg CreateRequirementParams) (Requirement, error) CreateSlate(ctx context.Context, arg CreateSlateParams) (Slate, error) CreateStaffingRecommendation(ctx context.Context, arg CreateStaffingRecommendationParams) (StaffingRecommendation, error) CreateUser(ctx context.Context, arg CreateUserParams) (User, error) DeleteExternalCandidate(ctx context.Context, id uuid.UUID) (int64, error) // Right to erasure: when a candidate is anonymized or sourced-erased, their recommendation rows are // removed (anonymize in place does not delete the candidate row, so this is explicit, mirroring the // ai_memory cleanup). DeleteRecommendationsForCandidate(ctx context.Context, candidateID *uuid.UUID) error // Erasure must also remove slate placements of the sourced person; slate_members has no ON DELETE rule // so the candidate delete would otherwise fail. RLS scopes this to the caller's org. DeleteSlateMembersForCandidate(ctx context.Context, candidateID uuid.UUID) error DetachSourcingLog(ctx context.Context, candidateID *uuid.UUID) error // Identity resolution blocking key 1: an exact (case insensitive) email match in the same org. Email is // the strongest identity signal, so a sourced lead with a known email merges into the existing person. FindCandidateByEmail(ctx context.Context, arg FindCandidateByEmailParams) (uuid.UUID, error) // Identity resolution blocking key 2: same normalized full name AND same normalized location in the org. // Name alone is too weak (two John Smiths); name plus location is a defensible second signal. The caller // only invokes this with a non empty location. FindCandidateByNameLocation(ctx context.Context, arg FindCandidateByNameLocationParams) (uuid.UUID, error) GetCandidate(ctx context.Context, id uuid.UUID) (Candidate, error) GetCandidateEvaluation(ctx context.Context, arg GetCandidateEvaluationParams) (CandidateEvaluation, error) GetOpportunity(ctx context.Context, id uuid.UUID) (Opportunity, error) GetOpportunityRecord(ctx context.Context, id uuid.UUID) (OpportunityRecord, error) GetOrganization(ctx context.Context, id uuid.UUID) (Organization, error) GetRequirement(ctx context.Context, id uuid.UUID) (Requirement, error) // One requirement with its backing opportunity value, provenance, and status, for the gap view. The // service uses deleted_at and the opportunity status to 404 a requirement that is not a real open gap. GetRequirementWithValue(ctx context.Context, id uuid.UUID) (GetRequirementWithValueRow, error) GetSamOpportunity(ctx context.Context, noticeID string) (SamOpportunity, error) GetSkillByName(ctx context.Context, name string) (Skill, error) GetSlate(ctx context.Context, id uuid.UUID) (Slate, error) // PK tiebreaker => total order [review SQLC-5] // The frozen decision record for one member: the full per component trace, rationale, and gap summary // for the audit and candidate facing explanation. GetSlateMember(ctx context.Context, arg GetSlateMemberParams) (SlateMember, error) // Locks the row for the decision path so two concurrent decisions on the same recommendation serialize; // the service checks existence (else 404) and status (else 409) under this lock before deciding. GetStaffingRecommendationForUpdate(ctx context.Context, id uuid.UUID) (StaffingRecommendation, error) GetUser(ctx context.Context, id uuid.UUID) (User, error) GetUserByEmail(ctx context.Context, lower string) (User, error) // audit_logs is append-only (enforced by trigger); only INSERT/SELECT are granted. InsertAuditLog(ctx context.Context, arg InsertAuditLogParams) (InsertAuditLogRow, error) InsertCandidateNotice(ctx context.Context, arg InsertCandidateNoticeParams) (AedtCandidateNotice, error) InsertSourcingLog(ctx context.Context, arg InsertSourcingLogParams) error // Identity resolution merge: link a sourced lead to an existing candidate. Sets the external id and // backfills headline and years ONLY where the existing row is empty or lower, never clobbering curated // bench data. Source is intentionally left unchanged so a verified bench person stays a bench person. LinkSourcedCandidate(ctx context.Context, arg LinkSourcedCandidateParams) error ListAedtInventory(ctx context.Context) ([]AedtInventory, error) // audit_logs has NO RLS policy by design. Bind the read to the validated session GUC (NOT a // caller supplied org param) so it inherits the same fail closed default deny as every RLS table, // a missing or wrong org can no longer leak another tenant's trail. Run inside RunInTenantTx so the GUC // is set [review AUDIT-2/RLS-3]. ListAuditLogsForOrg(ctx context.Context, arg ListAuditLogsForOrgParams) ([]AuditLog, error) // Incumbents and similar awards for a NAICS, largest first (excludes Galapagos own awards). ListAwardsByNaics(ctx context.Context, arg ListAwardsByNaicsParams) ([]UsaspendingAward, error) ListBlsWages(ctx context.Context) ([]BlsWage, error) ListCandidateCertifications(ctx context.Context, candidateID uuid.UUID) ([]string, error) ListCandidateCustomerExperience(ctx context.Context, candidateID uuid.UUID) ([]string, error) ListCandidateSkills(ctx context.Context, candidateID uuid.UUID) ([]ListCandidateSkillsRow, error) // id is a unique trailing sort key so created_at ties give a total order and stable LIMIT/OFFSET paging. ListCandidates(ctx context.Context, arg ListCandidatesParams) ([]Candidate, error) // Available (staffable) candidates first, most recently updated next, so the workforce intelligence // surface leads with the talent you can deploy and newly staffed or sourced people are always scored. // The trailing id makes the order total, so the same set is selected before the LIMIT cut every run. ListCandidatesForIntel(ctx context.Context, limit int32) ([]Candidate, error) // A candidate is committed to a requirement when they are an approved slate member (the source of truth) // or have an approved W3 ASSIGN that has not yet flowed to a slate (provisional commitment). The gap view // reads this so a committed candidate is classified REASSIGN, never a duplicate ASSIGN. ListCommitments(ctx context.Context) ([]ListCommitmentsRow, error) // The persisted screenMATCH qualifications for one requirement, joined to the candidate name and // availability, best first. missionMATCH "who can support this mission today" reads this STORED // artifact rather than rescore the pool. Both tables are RLS scoped, so the join cannot cross tenants. ListEvaluationsForRequirement(ctx context.Context, requirementID uuid.UUID) ([]ListEvaluationsForRequirementRow, error) // id is the unique trailing sort key so created_at ties leave a total order and the LIMIT cut is stable. ListExternalCandidates(ctx context.Context, limit int32) ([]ListExternalCandidatesRow, error) // Galapagos own past performance, largest first. ListGalapagosAwards(ctx context.Context, lim int32) ([]UsaspendingAward, error) // AEDT governance: model version registry, the org AEDT inventory, candidate notices, and the // retention sweep. All on the app pool under RLS (the eeo schema is reached only by the compliance // pool, never here). ListModelVersions(ctx context.Context) ([]AedtModelVersion, error) // Only requirements whose opportunity is open, plus standalone requirements (NULL opportunity_id), // mirroring the Command Center predicate (o.id IS NULL OR o.status='open'). The LEFT JOIN selects r.* // so the row type stays Requirement. Used by the Opportunity Fit Engine, which scores only OPEN ones. ListOpenRequirements(ctx context.Context, arg ListOpenRequirementsParams) ([]Requirement, error) // Open requirements with their backing opportunity dollar value and its provenance, for the portfolio // value function. A standalone requirement (no opportunity) has a null value and is handled by the // documented value fallback in the optimizer. ListOpenRequirementsWithValue(ctx context.Context, arg ListOpenRequirementsWithValueParams) ([]ListOpenRequirementsWithValueRow, error) ListOpportunities(ctx context.Context, arg ListOpportunitiesParams) ([]Opportunity, error) // Optional filters (NULL array = no filter). Soonest closing first, then most recently posted, then id // as a unique tiebreaker so the order is deterministic. Text equality filters compare upper() on both // sides; the service upper cases the params so casing drift cannot silently zero out results. ListOpportunityRecords(ctx context.Context, arg ListOpportunityRecordsParams) ([]OpportunityRecord, error) // The current bench watch: pending recommendations from proactive runs, capped and paginated. ListProactiveRecommendations(ctx context.Context, arg ListProactiveRecommendationsParams) ([]StaffingRecommendation, error) ListRequiredCertifications(ctx context.Context, requirementID uuid.UUID) ([]string, error) ListRequiredSkills(ctx context.Context, requirementID uuid.UUID) ([]ListRequiredSkillsRow, error) // id is a unique trailing sort key so the order is total: ties on created_at no longer leave the // LIMIT/OFFSET cut and the downstream Best Fit pick nondeterministic. ListRequirements(ctx context.Context, arg ListRequirementsParams) ([]Requirement, error) ListRequirementsForOpportunity(ctx context.Context, opportunityID *uuid.UUID) ([]Requirement, error) // All filters are optional (NULL array / NULL scalar = "no filter"). active_only defaults true at the // handler. Soonest-closing first, then most-recently-posted. // Text equality filters are case-insensitive (upper() both sides; the service upper-cases the params) // so casing drift from SAM's path text can't silently zero out results [review COR-3]. The title search // is a literal substring (position()), NOT a LIKE pattern, so q's %/_/\ are matched literally and a // trailing backslash can't 500 the request [review COR-1]. Past-deadline / null-deadline notices sort // to the bottom so the feed leads with what's still open [review COR-2]. ListSamOpportunities(ctx context.Context, arg ListSamOpportunitiesParams) ([]SamOpportunity, error) ListSkills(ctx context.Context, arg ListSkillsParams) ([]Skill, error) ListSlateMembers(ctx context.Context, slateID uuid.UUID) ([]SlateMember, error) // The slate roster joined to the candidate name for the slateMATCH detail and the branded export. Both // tables are RLS scoped to the caller's org, so the join cannot cross tenants. ListSlateMembersWithNames(ctx context.Context, slateID uuid.UUID) ([]ListSlateMembersWithNamesRow, error) ListSlatesForRequirement(ctx context.Context, requirementID uuid.UUID) ([]Slate, error) // id is the unique trailing sort key so collected_at ties leave a total order and the LIMIT cut is stable. ListSourcingLog(ctx context.Context, limit int32) ([]ListSourcingLogRow, error) // Platform/security events with NO org (e.g. failed logins before org resolution). Privileged read // path only, never the per-tenant app path, so these events are not a black hole [review AUDIT-3]. ListSystemAuditLogs(ctx context.Context, arg ListSystemAuditLogsParams) ([]AuditLog, error) ListUsers(ctx context.Context, arg ListUsersParams) ([]User, error) // Status guarded: only a pending row can be decided, so a row that was concurrently superseded or // decided returns no row and the service surfaces 409 rather than overwriting a dead or decided row. MarkRecommendationDecision(ctx context.Context, arg MarkRecommendationDecisionParams) (StaffingRecommendation, error) OpportunityRecordMeta(ctx context.Context) (OpportunityRecordMetaRow, error) // Band/decision rollup across every slate member under one opportunity's requirements, the source // for GET /proposal-readiness [review COMPL-2]. RLS scopes all three tables to the caller's org. ProposalReadiness(ctx context.Context, opportunityID *uuid.UUID) ([]ProposalReadinessRow, error) // Candidates whose most recent recorded decision is older than the retention window and whose PII is // not yet anonymized. The de identified slate_members outcomes are retained; only the candidate PII is // wiped (by AnonymizeCandidate). RLS scopes this to the caller's org. RetentionDueCandidates(ctx context.Context, dollar_1 int32) ([]uuid.UUID, error) SamSyncMeta(ctx context.Context) (SamSyncMetaRow, error) // Hybrid retrieval: pgvector cosine kNN fused with full-text rank via Reciprocal Rank Fusion (k=60). // RLS already scopes both legs to the caller's org. $1=query embedding, $2=limit, $3=text query. // The vector arm is MATERIALIZED so the relaxed_order HNSW output is re-sorted by TRUE cosine distance // before it is ranked: under hnsw.iterative_scan = relaxed_order the index returns rows slightly out of // distance order, and ranking them without the re-sort would mis-rank the nearest neighbors at scale // (pgvector 0.8 README; AWS pgvector 0.8 Aurora guidance). Every ORDER BY carries a unique tiebreaker // (id) so results are byte-stable for fixed inputs, the AEDT reproducibility mandate. The caller SETs // LOCAL hnsw.ef_search and hnsw.iterative_scan first. SearchCandidatesHybrid(ctx context.Context, arg SearchCandidatesHybridParams) ([]SearchCandidatesHybridRow, error) // Mission scoped hybrid retrieval (WS6 Option A): identical to SearchCandidatesHybrid, but BOTH arms are // additionally constrained to candidates whose search_tsv matches the mission keyword(s) in mission_query, // so a question can be scoped to a mission area (for example SIGINT) using only resume text match. This is // the only mission filter available without structured mission tags: those are WS7 work. It filters on // TEXT match, never on a semantic mission alignment, and that limit is documented in docs/AI_RESEARCH.md. // RLS still scopes both legs to the caller's org; every ORDER BY keeps the unique id tiebreaker so the // output is byte stable for fixed inputs, the AEDT reproducibility mandate. The caller SETs LOCAL // hnsw.ef_search and hnsw.iterative_scan first, exactly as for the unscoped query. SearchCandidatesHybridMission(ctx context.Context, arg SearchCandidatesHybridMissionParams) ([]SearchCandidatesHybridMissionRow, error) // Cosine nearest-neighbor over the skills ontology (powers semantic skill adjacency). SearchSkillsSemantic(ctx context.Context, arg SearchSkillsSemanticParams) ([]SearchSkillsSemanticRow, error) // An org FSO records HOW a candidate's clearance is known. RLS scopes this to the caller's own org. // verified_at is the date the FSO confirmed it; it is NULL for a self reported indicator. The platform // never verifies a clearance itself, it records the org's authoritative assertion. SetCandidateClearanceProvenance(ctx context.Context, arg SetCandidateClearanceProvenanceParams) (int64, error) // Human-in-the-loop: a person approves/rejects each member, optionally with a note. Never auto-decided. SetSlateMemberDecision(ctx context.Context, arg SetSlateMemberDecisionParams) (SlateMember, error) SoftDeleteCandidate(ctx context.Context, id uuid.UUID) error // A fresh gap run for a requirement supersedes ONLY the prior pending gap rows for that requirement. // Decided rows (approved, rejected, dismissed) are immutable and are never touched. SupersedePendingGap(ctx context.Context, requirementID uuid.UUID) error // A fresh portfolio run supersedes ONLY the prior pending portfolio rows for the org. Decided rows are // immutable. SupersedePendingPortfolio(ctx context.Context) error // A fresh proactive recompute for one candidate supersedes ONLY that candidate's prior pending proactive // rows. Decided rows are immutable. SupersedePendingProactive(ctx context.Context, candidateID *uuid.UUID) error TouchUserLogin(ctx context.Context, id uuid.UUID) error UpdateSlateStatus(ctx context.Context, arg UpdateSlateStatusParams) (Slate, error) UpsertAedtInventory(ctx context.Context, arg UpsertAedtInventoryParams) (AedtInventory, error) // USASpending awards cache. Global public catalog (no organization_id, outside RLS): reads run off // the pool, writes come from the daily sync (cmd/awards-sync) as the migrator role. UpsertAward(ctx context.Context, arg UpsertAwardParams) error // BLS OEWS wage baseline cache. Global public catalog (no organization_id, outside RLS): reads run // off the pool, writes come from the weekly rates sync (cmd/rates-sync) as the migrator role. UpsertBlsWage(ctx context.Context, arg UpsertBlsWageParams) error // Upsert the latest screenMATCH qualification for one (candidate, requirement) pair. A fresh screen // overwrites the prior row so there is exactly one current evaluation per pair, which missionMATCH // reads instead of recomputing. evaluated_at is preserved as the first time the pair was screened; // updated_at moves to now() on every rescreen. UpsertCandidateEvaluation(ctx context.Context, arg UpsertCandidateEvaluationParams) error // External candidate sourcing. The import command (cmd/import-candidates) writes as the migrator role // with an explicit organization_id; the delete path runs as the app role inside a tenant tx (RLS). UpsertExternalCandidate(ctx context.Context, arg UpsertExternalCandidateParams) (uuid.UUID, error) // Opportunity Intelligence unified records. Global public catalog (no organization_id, outside RLS): // reads run straight off the pool, writes come from cmd/opp-sync as the migrator role. UpsertOpportunityRecord(ctx context.Context, arg UpsertOpportunityRecordParams) error // SAM.gov opportunities cache. Global public catalog (no organization_id, outside RLS): reads run // straight off the pool, writes come from the daily sync (cmd/sam-sync) as the migrator role. UpsertSamOpportunity(ctx context.Context, arg UpsertSamOpportunityParams) error // COALESCE keeps an existing category or embedding when a caller upserts by name only (for example the // ingest and mission check paths that pass just a skill name), so a later name only upsert never nulls a // category that was set before and an embedding can still be backfilled once it is supplied. UpsertSkill(ctx context.Context, arg UpsertSkillParams) (Skill, error) WagesSyncMeta(ctx context.Context) (WagesSyncMetaRow, error) } var _ Querier = (*Queries)(nil)