# FixedPeriodCapRule

Industry: Workforce

A cap on time in `statuses` over whole local periods: "56 hours in an ISO week", "90 hours in two adjacent weeks", "80 hours a week averaged over four".

```ts
import type { FixedPeriodCapRule } 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` | `"fixedPeriodCap"` | Selects this rule kind. |
| `statuses` | `S[]` | The statuses whose time is capped. |
| `cap` | `string` | The most time allowed, per period with `average`, a positive ISO 8601 duration. |
| `period` | [`LocalPeriod`](/gmt/reference/types/LocalPeriod/) | The period, a count of local periods. |
| `adjacent?` | `number` | How many adjacent periods the cap covers, an integer from 1 to 10,000. Times the period's count, it is 10,000 at most. |
| `average?` | `boolean` | Whether `cap` limits the mean over the `adjacent` periods instead of their total. |

## Definition

```ts
type FixedPeriodCapRule<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: "fixedPeriodCap";
  /** The statuses whose time is capped. */
  statuses: S[];
  /** The most time allowed, per period with `average`, a positive ISO 8601 duration. */
  cap: string;
  /** The period, a count of local periods. */
  period: LocalPeriod;
  /**
   * How many adjacent periods the cap covers, an integer from 1 to 10,000. Times the period's
   * count, it is 10,000 at most.
   *
   * @defaultValue `1`.
   */
  adjacent?: number;
  /**
   * Whether `cap` limits the mean over the `adjacent` periods instead of their total.
   *
   * @defaultValue `false`.
   */
  average?: boolean;
};
```

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