# QuotaRule

Industry: Workforce

A cap on how often a short rest is taken: "at most 3 reduced rests between two full rests".

```ts
import type { QuotaRule } 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` | `"quota"` | Selects this rule kind. |
| `event` | `object` | The run that counts once. |
| `event.statuses` | `S[]` | The statuses the run is made of. |
| `event.minimum` | `string` | The shortest run that counts, a positive ISO 8601 duration of exact time. |
| `event.maximum` | `string` | The length a run must stay under to count, a positive ISO 8601 duration of exact time. |
| `count` | `number` | The most events allowed, a non-negative integer. |
| `reset` | `Reset<S>` \| `object` ([`Reset`](/gmt/reference/types/Reset/), [`Period`](/gmt/reference/types/Period/)) | What starts the count again: a full rest, or a window. |
| `reset.every` | [`Period`](/gmt/reference/types/Period/) | The window the events are counted in. |

## Definition

```ts
type QuotaRule<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: "quota";
  /** The run that counts once. */
  event: {
    /** The statuses the run is made of. */
    statuses: S[];
    /** The shortest run that counts, a positive ISO 8601 duration of exact time. */
    minimum: string;
    /** The length a run must stay under to count, a positive ISO 8601 duration of exact time. */
    maximum: string;
  };
  /** The most events allowed, a non-negative integer. */
  count: number;
  /** What starts the count again: a full rest, or a window. */
  reset:
    | Reset<S>
    | {
        /** The window the events are counted in. */
        every: Period;
      };
};
```

## 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)
