# `Diffo.Provider.BaseCharacteristic`
[🔗](https://github.com/diffo-dev/diffo/blob/v0.9.0/lib/diffo/provider/components/base_characteristic.ex#L5)

Ash Resource Fragment which is the point of extension for typed TMF Characteristics.

`BaseCharacteristic` is the foundation for domain-specific Characteristic kinds.
Include it as a fragment on an `Ash.Resource` to get a typed characteristic node
in Neo4j with real Ash attributes — no `Ash.Type.Dynamic` required.

`Diffo.Provider.Characteristic` remains available as the generic dynamic option
(storing values via `Diffo.Type.Value`); it includes `Characteristic.Extension` so
the DSL verifier accepts it alongside typed resources.

## Usage

    defmodule MyApp.CircuitCharacteristic do
      use Ash.Resource, fragments: [BaseCharacteristic], domain: MyApp.Domain

      attributes do
        attribute :bandwidth_mbps, :integer, public?: true
        attribute :technology, :atom, public?: true
      end

      actions do
        create :create do
          accept [:name, :bandwidth_mbps, :technology]
          argument :instance_id, :uuid
          argument :feature_id, :uuid
        end

        update :update do
          accept [:bandwidth_mbps, :technology]
        end
      end

      calculations do
        calculate :value, Diffo.Type.CharacteristicValue, Diffo.Provider.Calculations.CharacteristicValue do
          public? true
        end
      end

      preparations do
        prepare build(load: [:value])
      end

      jason do
        pick [:name, :value]
        compact true
      end
    end

## DSL declaration

    provider do
      characteristics do
        characteristic :circuit, MyApp.CircuitCharacteristic
      end
    end

At build time a `CircuitCharacteristic` node is created and connected to the
instance via an `:HAS` edge. The `name` attribute (e.g. `:circuit`) identifies
the characteristic's role on the instance.

## Typed vs dynamic

| Style | DSL target | Neo4j node | Value storage |
|-------|-----------|------------|---------------|
| Typed | `BaseCharacteristic`-derived | per-type label (e.g. `:CircuitCharacteristic`) | direct Ash attributes |
| Dynamic | `Diffo.Provider.Characteristic` | `:Characteristic` | `Diffo.Type.Value` dynamic |

# `extensions`

# `opts`

# `persisted`

# `spark_dsl_config`

# `validate_sections`

---

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