# `PhoenixKitEcommerce.Import.ImportFormat`
[🔗](https://github.com/BeamLabEU/phoenix_kit_ecommerce/blob/v0.1.8/lib/phoenix_kit_ecommerce/import/import_format.ex#L1)

Behaviour for CSV import format adapters.

All CSV format modules (Shopify, Prom.ua, etc.) implement this behaviour
to provide a uniform interface for the import pipeline.

# `count`

```elixir
@callback count(path :: String.t(), config :: PhoenixKitEcommerce.ImportConfig.t() | nil) ::
  non_neg_integer()
```

Counts the number of products that will be imported from the file.

# `default_config_attrs`

```elixir
@callback default_config_attrs() :: map()
```

Returns default attrs for seeding an ImportConfig for this format.

# `detect?`

```elixir
@callback detect?(headers :: [String.t()]) :: boolean()
```

Returns true if the given CSV headers match this format.

# `parse_and_transform`

```elixir
@callback parse_and_transform(
  path :: String.t(),
  categories_map :: map(),
  config :: PhoenixKitEcommerce.ImportConfig.t() | nil,
  opts :: keyword()
) :: Enumerable.t()
```

Parses CSV and returns a list/stream of product attrs maps ready for `Shop.upsert_product/1`.

# `requires_option_mapping?`

```elixir
@callback requires_option_mapping?() :: boolean()
```

Whether the :configure wizard step (option mapping UI) should be shown.

---

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