# `MishkaPay.Usage.Summary`
[🔗](https://github.com/mishka-group/mishka_pay/blob/v0.0.1/nofile#L1)

What a meter counted for one customer over a window of time, read with
`MishkaPay.usage_summary/6`. A guarded_struct the provider fills in.

  * `:provider`, `:meter_id`, `:customer_id`: whose usage, on which meter.
  * `:value`: the usage the meter's aggregation gives for the window (a sum, a count or the
    last value), as the provider reports it; 0 when nothing was reported.
  * `:from`, `:to`: the window the provider counted, `:to` not included. A provider may widen
    the window asked for to its own boundaries, such as whole minutes at Stripe.

A provider counts usage a little after it is reported, so a report made a moment ago may not
be in the value yet.

# `t`

```elixir
@type t() :: %MishkaPay.Usage.Summary{
  customer_id: String.t() | nil,
  from: DateTime.t() | nil,
  meter_id: String.t() | nil,
  provider: String.t() | nil,
  to: DateTime.t() | nil,
  value: number() | nil
}
```

The struct that `builder/1` returns.

| Field | Type | Required | Default | Description | Derives |
| --- | --- | --- | --- | --- | --- |
| `:provider` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:meter_id` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:customer_id` | `String.t()` \| `nil` | no |  |  | `validate(string)` |
| `:value` | `number()` \| `nil` | no | `0` |  |  |
| `:from` | `DateTime.t()` \| `nil` | no |  |  | `validate(struct)` |
| `:to` | `DateTime.t()` \| `nil` | no |  |  | `validate(struct)` |

# `builder`

# `enforce_keys`

# `enforce_keys`

# `example`

A sample %MishkaPay.Usage.Summary{} populated from defaults + type-based fallbacks.

# `keys`

# `keys`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
