# `Gno.Service.Setup.Extension`
[🔗](https://github.com/rdf-elixir/gno/blob/v0.1.0/lib/gno/service/setup/extension.ex#L1)

Behavior for `Gno.Service.Setup` extensions with custom setup logic.

# `check_setup`

```elixir
@callback check_setup(
  Gno.Service.t(),
  keyword()
) :: :ok | {:error, term()}
```

Checks if the service's repository is set up, i.e. exists.

Called during setup to verify if the repository already exists and is accessible.
Implementations should implement a minimal check to verify the repository exists.
More detailed validation should be done in the `validate/2` callback.

# `setup`

```elixir
@callback setup(
  Gno.Service.t(),
  keyword()
) :: {:ok, Gno.Service.t()} | {:error, term()}
```

Performs extension-specific initialization during setup.

Called after the repository has been initialized but before validation.
The extension can perform any additional setup steps needed, such as:

- Creating application-specific graphs
- Setting up initial data structures
- Configuring external systems

Returns the service (potentially modified) on success.

# `teardown`

```elixir
@callback teardown(
  Gno.Service.t(),
  keyword()
) :: :ok | {:error, term()}
```

Performs extension-specific teardown.

# `validate`

```elixir
@callback validate(
  Gno.Service.t(),
  keyword()
) :: :ok | {:error, term()}
```

Validates the setup state after all initialization is complete.

Called as the final step of setup to ensure everything is properly configured.
Should check that all required components are in place and properly initialized.

# `__using__`
*macro* 

Provides default implementations of the setup extension callbacks.

## Examples

    defmodule MyApp.Setup do
      use Gno.Service.Setup.Extension

      @impl true
      def setup(service, opts) do
        # Custom setup logic here
        {:ok, service}
      end
    end

---

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