# UsageLookbackRule

Industry: Workforce

An allowance used at most once inside a window, restored by a rest: "not used within the previous 7 days unless 34 hours off came between".

```ts
import type { UsageLookbackRule } from "@northguild/gmt";
```

## Members

| Member | Type | Description |
| --- | --- | --- |
| `label` | `string` | The caller's name for the rule. The report is keyed by it; labels must be unique. |
| `severity?` | `"violation"` \| `"advisory"` ([`DutySeverity`](/gmt/reference/types/DutySeverity/)) | Whether a failure is a violation or an advisory. |
| `kind` | `"usageLookback"` | Selects this rule kind. |
| `uses` | `string[]` | The instants the allowance was used, as ISO 8601 instant strings. |
| `notWithin` | [`Period`](/gmt/reference/types/Period/) | The window no second use may fall in. |
| `reset` | `Reset<S>` ([`Reset`](/gmt/reference/types/Reset/)) | The rest that restores the allowance. |

## Definition

```ts
type UsageLookbackRule<S extends string = string> = {
  /** The caller's name for the rule. The report is keyed by it; labels must be unique. */
  label: string;
  /**
   * Whether a failure is a violation or an advisory.
   *
   * @defaultValue `"violation"`.
   */
  severity?: DutySeverity;
  /** Selects this rule kind. */
  kind: "usageLookback";
  /** The instants the allowance was used, as ISO 8601 instant strings. */
  uses: string[];
  /** The window no second use may fall in. */
  notWithin: Period;
  /** The rest that restores the allowance. */
  reset: Reset<S>;
};
```

## Used by

- [`dutyViolations`](/gmt/reference/workforce/calculate/dutyViolations/)
- [`evaluateDutyLog`](/gmt/reference/workforce/calculate/evaluateDutyLog/)

## Source

[types/duty.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/types/duty.ts)
