# Check spare capacity for the incoming support channel

Evaluate remaining email and message slots separately for the same eligible staff.

## Choose the channel before counting slots

This local example has two channels: email and message. Remaining slots equal the chosen channel’s limit minus used slots. Agents also need exports and active status. Used slots cannot exceed the declared limit; that would be an invalid input, not negative spare capacity. These counts are not workload hours or a waiting-time forecast.

Filled channel capacity sheet

| Agent | Email used / limit | Message used / limit | New message |
| --- | --- | --- | --- |
| A | 2 / 5 | 2 / 2 | Full |
| B | 5 / 5 | 0 / 2 | Eligible: 2 slots |

## Apply all conditions to the chosen channel

A new message can go to B under the eligibility contract. A new email can go to A. Neither route is decided by adding all unused channel slots together. The model displays each agent’s capability/status/slot checks.

1. Select email or message
2. Subtract used from the channel limit
3. Apply skills and active status
4. List eligible and unknown agents

An unknown capacity record stays unknown; do not substitute the other channel’s record.

Switch the incoming channel to email. Which agent passes?

A: 5−2=3 email slots. B has 5−5=0 email slots, so B is full.

## Edit channel load without changing capability

Change the channel selector or A’s message used count. Reducing A’s message count to 1 makes both A and B eligible for a message. Reset restores A’s two occupied message slots and the message channel.

A message used value of 3 with a limit of 2 is rejected as CAPACITY_INPUT. A null capacity is an unknown fact. Limits and used counts must be whole numbers 0–1,000. Manual self-assignment and total human effort are outside this model.

Use the queue-order example when the request enters the wrong team even though eligible staff exist.

## Complete local records and trace

```json
{
  "issuer": "Astera Technology",
  "resource": "ops-route-channel-capacity",
  "locale": "en",
  "contract": "This local example has two channels: email and message. Remaining slots equal the chosen channel’s limit minus used slots. Agents also need exports and active status. Used slots cannot exceed the declared limit; that would be an invalid input, not negative spare capacity. These counts are not workload hours or a waiting-time forecast.",
  "input": {
    "channel": "message",
    "required": [
      "exports"
    ],
    "agents": [
      {
        "id": "A",
        "skills": [
          "exports"
        ],
        "status": "active",
        "capacity": {
          "email": {
            "used": 2,
            "limit": 5
          },
          "message": {
            "used": 2,
            "limit": 2
          }
        }
      },
      {
        "id": "B",
        "skills": [
          "exports"
        ],
        "status": "active",
        "capacity": {
          "email": {
            "used": 5,
            "limit": 5
          },
          "message": {
            "used": 0,
            "limit": 2
          }
        }
      }
    ]
  },
  "output": {
    "ok": true,
    "state": "complete",
    "result": {
      "eligible": [
        "B"
      ],
      "unknown": []
    },
    "trace": [
      {
        "id": "A",
        "skills": true,
        "available": true,
        "spare": false,
        "remaining": 0,
        "decision": "ineligible"
      },
      {
        "id": "B",
        "skills": true,
        "available": true,
        "spare": true,
        "remaining": 2,
        "decision": "eligible"
      }
    ]
  },
  "verificationCases": [
    {
      "name": "baseline",
      "input": {
        "channel": "message",
        "required": [
          "exports"
        ],
        "agents": [
          {
            "id": "A",
            "skills": [
              "exports"
            ],
            "status": "active",
            "capacity": {
              "email": {
                "used": 2,
                "limit": 5
              },
              "message": {
                "used": 2,
                "limit": 2
              }
            }
          },
          {
            "id": "B",
            "skills": [
              "exports"
            ],
            "status": "active",
            "capacity": {
              "email": {
                "used": 5,
                "limit": 5
              },
              "message": {
                "used": 0,
                "limit": 2
              }
            }
          }
        ]
      },
      "expected": {
        "ok": true,
        "state": "complete",
        "result": {
          "eligible": [
            "B"
          ],
          "unknown": []
        }
      }
    },
    {
      "name": "material-edit",
      "input": {
        "channel": "email",
        "required": [
          "exports"
        ],
        "agents": [
          {
            "id": "A",
            "skills": [
              "exports"
            ],
            "status": "active",
            "capacity": {
              "email": {
                "used": 2,
                "limit": 5
              },
              "message": {
                "used": 2,
                "limit": 2
              }
            }
          },
          {
            "id": "B",
            "skills": [
              "exports"
            ],
            "status": "active",
            "capacity": {
              "email": {
                "used": 5,
                "limit": 5
              },
              "message": {
                "used": 0,
                "limit": 2
              }
            }
          }
        ]
      },
      "expected": {
        "ok": true,
        "state": "complete",
        "result": {
          "eligible": [
            "A"
          ],
          "unknown": []
        }
      }
    },
    {
      "name": "fresh-boundary",
      "input": {
        "channel": "message",
        "required": [
          "exports"
        ],
        "agents": [
          {
            "id": "A",
            "skills": [
              "exports"
            ],
            "status": "active",
            "capacity": {
              "email": {
                "used": 2,
                "limit": 5
              },
              "message": {
                "used": 3,
                "limit": 2
              }
            }
          },
          {
            "id": "B",
            "skills": [
              "exports"
            ],
            "status": "active",
            "capacity": {
              "email": {
                "used": 5,
                "limit": 5
              },
              "message": {
                "used": 0,
                "limit": 2
              }
            }
          }
        ]
      },
      "expected": {
        "ok": false,
        "error": "CAPACITY_INPUT"
      }
    }
  ],
  "meaningOfNull": "Unknown or no established value for the field; inspect its specific trace.",
  "businessSideEffects": false
}
```
