import type { ReactNode } from 'react'
import {
AlertTriangle,
Award,
BadgeCheck,
Briefcase,
CalendarClock,
CheckCircle2,
Clock,
Crown,
FileText,
MapPin,
ShieldCheck,
Target,
TrendingUp,
} from 'lucide-react'
import type { CandidateListView, RequirementListView, ScreenView } from '../lib/types'
import { bandColor, clearanceLabel, num, stateColor } from '../lib/format'
import { Badge, CheckRow, Panel, ScoreRow } from './ui'
import { Gauge } from './Gauge'
function winColor(code: string): string {
return code === 'high'
? 'var(--color-ok)'
: code === 'medium'
? 'var(--color-warn)'
: 'var(--color-risk)'
}
export function ScreeningResults({
view,
candidate,
requirement,
hideHeader = false,
}: {
view: ScreenView
candidate: CandidateListView
requirement: RequirementListView
hideHeader?: boolean
}) {
const mr = view.mission_readiness
const ci = view.clearance_intelligence
const wi = view.win_impact
const matched = view.match.matched_skills.filter((m) => m.matched)
return (
{/* SECTION A, Candidate Summary */}
{!hideHeader && (
{candidate.full_name
.split(' ')
.map((p) => p[0])
.slice(0, 2)
.join('')}
{candidate.full_name}
{requirement.title}
{candidate.years_experience} yrs
{candidate.location && (
{candidate.location}
)}
{clearanceLabel[candidate.clearance_level] ?? candidate.clearance_level}
{candidate.available ? 'Available Now' : 'Not Available'}
)}
{/* SECTION B, Mission Readiness gauge */}
{view.match.explanation}
{/* SECTION C + D, Requirement summary + qualification breakdown */}
{requirement.title}
{requirement.customer_agency ?? 'No specific customer'} ·{' '}
{clearanceLabel[requirement.required_level] ?? requirement.required_level} required
{requirement.key_personnel && (
Key Personnel
)}
{mr.categories.map((cat) => (
))}
Evidence
{view.match.trace.map((t) => (
{t.component} ({t.weight}): {t.rationale}
))}
Weight profile {view.match.weight_profile_version}, applied by the scoring engine and recorded with this result.
{/* SECTION H (Win) + Clearance Intelligence */}
{wi.level}
Staffing strength {num(wi.staffing_strength).toFixed(0)}%
{(wi.reasons ?? []).map((r) => (
-
{r}
))}
{ci.current}
{ci.expired ? 'Expired' : ci.status}
{ci.verified ? '✓ ' : ''}
{ci.provenance_label}
{ci.verified_at ? ` ${ci.verified_at}` : ''}
{ci.sci_eligible && SCI Eligible}
{ci.ci_poly_eligible && CI Poly Eligible}
{ci.full_scope_poly && Full Scope Poly}
{ci.recent_classified_support && Recent Classified Support}
{typeof ci.investigation_age_months === 'number' && (
} k="Investigation age" v={`${ci.investigation_age_months} mo`} />
)}
{ci.expires_at &&
} k="Expires" v={ci.expires_at} />}
{/* SECTION E, Top Matching Skills */}
{matched.length === 0 ? (
No specific skills required for this requirement.
) : (
{matched.map((m) => (
{m.required_skill}
{m.exact ? 'Exact' : `Semantic ${(num(m.similarity) * 100).toFixed(0)}%`}
))}
)}
{/* SECTION F, Gaps to Review */}
{view.battle_card.gaps.length === 0 ? (
No mandatory gaps identified.
) : (
{view.battle_card.gaps.map((g) => (
-
{g}
))}
)}
{/* SECTION H, Battle Card */}
Strengths
{view.battle_card.strengths.length === 0 && - n/a
}
{view.battle_card.strengths.map((s) => (
-
{s}
))}
Risks
{view.battle_card.gaps.length === 0 && - None
}
{view.battle_card.gaps.map((g) => (
-
{g}
))}
{/* Contract Readiness */}
{view.contract_readiness.areas.map((a) => (
))}
{view.contract_readiness.risks.length > 0 && (
Risk Areas
{view.contract_readiness.risks.map((r) => (
-
{r.message}
))}
)}
{/* SECTION I, Recommended Next Actions */}
{view.next_steps.map((step, i) => (
))}
)
}
function Tag({ children }: { children: ReactNode }) {
return (
{children}
)
}
function Row({ icon, k, v }: { icon: ReactNode; k: string; v: string }) {
return (
{icon} {k}
{v}
)
}