# `MishkaCmsCore.Runtime.ErrorPageDraft`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/resources/error_page_draft.ex#L5)

An unpublished working copy of a runtime `MishkaCmsCore.Runtime.ErrorPage` — the ErrorPage analogue
of `MishkaCmsCore.Runtime.PageDraft`.

Unlike Page/Layout (a single `:template`), an ErrorPage's editable content is the **`error_pages`
collection** (a list of `%{status, template, layout}`), so a draft carries that whole collection.
The preview modal's Code tab edits the collection serialized as `<!-- 404 -->`-delimited blocks —
`<!-- offline -->` for the offline page, see `MishkaCmsCore.Runtime.ErrorStatus` — (round-tripped
via `RuntimePreview.source/1` + `RuntimePreview.parse_error_pages/1`).

Publishing is explicit (`:publish` / `:master_publish`): it writes the draft's fields to the live
ErrorPage (creating it when `source_error_page_id` is `nil`, otherwise updating all but its
`helpers`). See `MishkaCmsCore.Runtime.Resources.Changes.PublishErrorPageDraft`. Per-site only
(`global? false`), like Page.

# `t`

```elixir
@type t() :: %MishkaCmsCore.Runtime.ErrorPageDraft{
  __lateral_join_source__: term(),
  __meta__: term(),
  __metadata__: term(),
  __order__: term(),
  active: term(),
  aggregates: term(),
  applied_at: term(),
  calculations: term(),
  error_pages: term(),
  extra: term(),
  format: term(),
  helpers: term(),
  id: term(),
  inserted_at: term(),
  label: term(),
  name: term(),
  path: term(),
  precompile: term(),
  preview_token: term(),
  priority: term(),
  root_layout_template: term(),
  site: term(),
  site_id: term(),
  source_error_page: term(),
  source_error_page_id: term(),
  source_hash: term(),
  status: term(),
  updated_at: term()
}
```

# `default_short_name`

# `generate_token`

Generate an unguessable URL-safe preview token.

# `input`

```elixir
@spec input(values :: map() | Keyword.t()) :: map() | no_return()
```

Validates that the keys in the provided input are valid for at least one action on the resource.

Raises a KeyError error at compile time if not. This exists because generally a struct should only ever
be created by Ash as a result of a successful action. You should not be creating records manually in code,
e.g `%MyResource{value: 1, value: 2}`. Generally that is fine, but often with embedded resources it is nice
to be able to validate the keys that are being provided, e.g

```elixir
Resource
|> Ash.Changeset.for_create(:create, %{embedded: EmbeddedResource.input(foo: 1, bar: 2)})
|> Ash.create()
```

# `input`

```elixir
@spec input(values :: map() | Keyword.t(), action :: atom()) :: map() | no_return()
```

Same as `input/1`, except restricts the keys to values accepted by the action provided.

# `primary_key_matches?`

---

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