# `Statifier.Validator.Checks.Donedata`
[🔗](https://github.com/riddler/statifier-ex/blob/v2.0.0/lib/statifier/validator/checks/donedata.ex#L1)

Check 8 (spec 3.7, 5.7): `<donedata>` is only legal on a `:final` state.
Reports `{:donedata_not_on_final, id}` for any non-`:final` state
carrying a non-nil `donedata`, at the `donedata`'s own `location` -
`lib/statifier/document/donedata.ex` names this check as the layer that
reports the shape rather than one that refuses to build it.

A second rule, spec 5.5's content model: "either a single `<content>`
element or one or more `<param>` elements as children of `<donedata>`, but
not both." Reports `{:donedata_content_and_params, id}` for a `<donedata>`
carrying both a `<content>` child and one or more `<param>` children, at
the `<donedata>`'s own `location`. `lib/statifier/document/donedata.ex`
makes `content` and `params` both representable at once precisely so this
arm can report the shape rather than lowering refusing to build it - the
same division of labour the first rule above already has. This arm is
inert until `<param>` is supported, and it is written now so it lands with
`<param>` rather than being rediscovered then.

# `check`

```elixir
@spec check(
  document :: Statifier.Document.t(),
  context :: Statifier.Validator.Context.t()
) :: [
  Statifier.Validator.Error.t()
]
```

Returns a `:donedata_not_on_final` error for every state that carries a
non-nil `donedata` but is not itself a `:final` state, and a
`:donedata_content_and_params` error for every `<donedata>` that carries
both a `<content>` child and one or more `<param>` children. Returns `[]`
when every `<donedata>` element in the document sits on a `<final>` and
specifies at most one of `<content>`/`<param>`.

---

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