# `MishkaCmsMigration.Targets.BlogCollection`
[🔗](https://github.com/mishka-group/mishka_cms_migration/blob/v0.0.1/lib/mishka_cms_migration/targets/blog_collection.ex#L6)

The `"category"` items of a source written as the Blog's categories (`MishkaBlog.Collection`),
through the `:create` and `:update` an admin's own category form runs, on the run's site and
as the admin who pressed Import: the admin needs the Blog's `admin:dashboard:blog:post`, and
the Blog's own rules decide the rest, such as one slug per site and how a slug is written (its
`slugify`).

An item's title is the category's name, its `"slug"` and `"description"` the category's own
(an empty description is none), and its parent the category's parent category: the walk writes
the parent first, whichever the source lists first, so a nested category lands under the one
it sat under (`MishkaCmsMigration.Target`, "An item's parent"). A category is active, as a
WordPress category is live once it exists, and in the language the item names
(a site that runs Polylang or WPML names one), joined as one group with the categories that are
its other editions, or, for an item that names none, in the language the site leads with
(`MishkaCmsMigration.Targets.Helpers.Editions`). An item in a language the site does not publish
in waits for an admin's decision.

A category the run's site already has, with the slug as the Blog writes it, in any language,
waits for an admin's decision (`"slug_taken"`, `MishkaCmsMigration.Targets.Helpers.BySlug`).
Connect to the existing record makes the item that category: it is not written, the posts that
name it are linked to it, the categories that sat under it in the source go under it, the
report says `"connected"`, and the category is kept as it is, now and on every later run.
Import as new with another slug writes the item as a category of its own, its slug followed by
its source id, and the report says `"another_slug"`.

Defined only where Mishka Blog is loaded, and supervised by `MishkaCmsMigration.Application`
only then; on a node without the Blog its items wait for it (`"blog_missing"`).

# `error_return`

```elixir
@type error_return() ::
  {:error, [%{action: atom(), field: atom(), message: String.t()}]}
```

# `okey_return`

```elixir
@type okey_return() :: {:ok, struct() | map() | module() | [any()]}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `config`

```elixir
@spec config() :: keyword()
```

# `config`

```elixir
@spec config(atom()) :: any()
```

# `enable`

```elixir
@spec enable() :: okey_return() | error_return()
```

# `get`

```elixir
@spec get() :: keyword()
```

# `health_check`

```elixir
@spec health_check() :: :ok | {:degraded, term()} | {:error, term()}
```

Optional. See `c:MishkaInstaller.Event.Hook.health_check/0`. Override to report health.

# `on_dependency_error`

```elixir
@spec on_dependency_error(term()) :: term()
```

Optional. See `c:MishkaInstaller.Event.Hook.on_dependency_error/1`. Override to react.

# `register`

```elixir
@spec register() :: okey_return() | error_return()
```

# `restart`

```elixir
@spec restart() :: okey_return() | error_return()
```

# `start`

```elixir
@spec start() :: okey_return() | error_return()
```

# `start_link`

# `stop`

```elixir
@spec stop() :: okey_return() | error_return()
```

# `unregister`

```elixir
@spec unregister() :: okey_return() | error_return()
```

---

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