# Lead Distribution Monitoring

## Purpose and scope

The Admin Round Robin Monitor and Lead Credit Monitor are operational views only.
They report the existing distribution and credit rules; neither monitor changes an
assignment, cursor, membership, approval, work mode, or balance.

## Operator catalogue

Both monitors use the active `TakafulOperator` catalogue. An inactive operator and
its Agents are intentionally excluded from the current operational scope. This
prevents retired or test operators from appearing as an actionable queue.

## Standard TakafulHub distribution

For a standard operator queue, an Agent is eligible when all of the following are
true:

1. the account is active;
2. the Membership is active; and
3. the Lead Credit balance is positive.

The Lead Credit Monitor is the authoritative operational explanation of these three
conditions. It presents the first blocking reason in the same order as the shared
`LeadDistributionEligibilityService`.

## GETB / VastPro queue

Great Eastern GETB work uses the existing `vastpro_getb` queue. Its current
eligibility contract is intentionally different: active account, an approved
VastPro Agent profile, Work mode (not Vacation), and positive Lead Credits.
TakafulHub Membership is **not required** and is displayed as such rather than as
an inactive Membership. The Round Robin GET candidate denominator deliberately
contains only GET users with a VastPro Agent profile, which matches the automatic
distribution query; unrelated GET users are not treated as GETB candidates.
Manual assignment remains governed by its existing service and is not changed by
the monitor.

## Round Robin state

`assignment_counter` is shown as completed assignments, not as a synthetic queue
position. `last_assigned` is the current cursor record when it still resolves to an
Agent; otherwise the monitor safely displays “Never assigned”. Pending assignments
are linked to their existing Admin lead detail so the operator can inspect the
context without a new workflow.

## Attention semantics

An operator is Ready when it has at least one queue-eligible Agent and no pending
assignment. It needs attention when there are no registered or no eligible Agents.
Pending assignments are also counted in the summary’s attention total because
distribution is not complete, while retaining their own `Pending assignments` state
in the list for a precise explanation.
