# `PhoenixKitCatalogue.Catalogue.Suppliers`
[🔗](https://github.com/BeamLabEU/phoenix_kit_catalogue/blob/0.1.14/lib/phoenix_kit_catalogue/catalogue/suppliers.ex#L1)

Suppliers — delivery companies linked to manufacturers via the
many-to-many `phoenix_kit_cat_manufacturer_suppliers` table.

Same lifecycle as manufacturers: hard-delete only, `"active"` /
`"inactive"` status.

Public surface is re-exported from `PhoenixKitCatalogue.Catalogue`.

# `change_supplier`

```elixir
@spec change_supplier(PhoenixKitCatalogue.Schemas.Supplier.t(), map()) ::
  Ecto.Changeset.t(PhoenixKitCatalogue.Schemas.Supplier.t())
```

Returns a changeset for tracking supplier changes.

# `create_supplier`

```elixir
@spec create_supplier(
  map(),
  keyword()
) ::
  {:ok, PhoenixKitCatalogue.Schemas.Supplier.t()}
  | {:error, Ecto.Changeset.t(PhoenixKitCatalogue.Schemas.Supplier.t())}
```

Creates a supplier.

## Required attributes

  * `:name` — supplier name (1-255 chars)

## Optional attributes

  * `:description`, `:website`, `:contact_info`, `:notes`
  * `:status` — `"active"` (default) or `"inactive"`
  * `:data` — flexible JSON map

# `delete_supplier`

```elixir
@spec delete_supplier(
  PhoenixKitCatalogue.Schemas.Supplier.t(),
  keyword()
) ::
  {:ok, PhoenixKitCatalogue.Schemas.Supplier.t()}
  | {:error, Ecto.Changeset.t(PhoenixKitCatalogue.Schemas.Supplier.t())}
```

Hard-deletes a supplier from the database.

# `get_supplier`

```elixir
@spec get_supplier(Ecto.UUID.t()) :: PhoenixKitCatalogue.Schemas.Supplier.t() | nil
```

Fetches a supplier by UUID. Returns `nil` if not found.

# `get_supplier!`

```elixir
@spec get_supplier!(Ecto.UUID.t()) :: PhoenixKitCatalogue.Schemas.Supplier.t()
```

Fetches a supplier by UUID. Raises `Ecto.NoResultsError` if not found.

# `list_suppliers`

```elixir
@spec list_suppliers(keyword()) :: [PhoenixKitCatalogue.Schemas.Supplier.t()]
```

Lists all suppliers, ordered by name.

## Options

  * `:status` — filter by status (e.g. `"active"`, `"inactive"`).

# `update_supplier`

```elixir
@spec update_supplier(PhoenixKitCatalogue.Schemas.Supplier.t(), map(), keyword()) ::
  {:ok, PhoenixKitCatalogue.Schemas.Supplier.t()}
  | {:error, Ecto.Changeset.t(PhoenixKitCatalogue.Schemas.Supplier.t())}
```

Updates a supplier with the given attributes.

---

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