# toModelProjectionBase

FUNCTION in `@skmtc/core 0.63.4`

Build a model projection base class from a per-generator config.

The returned class extends `base` - the generator's language
snippet base - so the projection hierarchy is language-bound at its root
while core stays language-blind (the base arrives as an opaque
constructor; core never names a concrete language class). The class
exposes the generator's `id`, `toIdentifierName`, `toIdentifierType`,
and `toExportPath` statics, inherits the
static `lang` from the base, and
injects `generatorKey` so subclasses don't have to.

Defines NO `register` / `registerInto` - register ergonomics are typed by
each language's concise vocabulary, which core can't name, so they live
in the language package's projection-base veneer over this factory.

The projection machinery previously hosted on `ModelProjectionBase` lives
here now, because the base class is no longer statically known.

## Signature

```ts
import { toModelProjectionBase } from '@skmtc/core'

toModelProjectionBase<EnrichmentType = undefined, IdType extends IdentifierType = IdentifierType, ProjectionOptions = undefined>(
  base: LangSnippetConstructor,
  config: ModelProjectionBaseConfig<EnrichmentType, IdType, ProjectionOptions>
): ModelProjectionBaseClass<EnrichmentType, IdType, ProjectionOptions>
```

## Parameters

- `base` (LangSnippetConstructor, required)
- `config` (ModelProjectionBaseConfig<EnrichmentType, IdType, ProjectionOptions>, required)
  - `id` (string, required)
  - `toIdentifierName` ((args: ToModelIdentifierNameArgs<EnrichmentType, ProjectionOptions>) => string, required): Pure: the cache-key name. With no projection options, `toModelContentSettings` asks for it once in a run and keeps it.
  - `toIdentifierType` ((ref: RefParts, context: GenerateContextType) => IdType, required): Context-aware, overridable: the non-`name` parts of the identifier (`type` / `typeName` / `exported`), derived from the schema. Runs only on cache-miss. Returns `IdType` - the veneer's `XxIdentifierType`, whose `type` is bound to that language's `EntityType` vocabulary (the loose `string` by default). The tightening rides the type argument.
  - `toExportPath` ((args: ToModelExportPathArgs<EnrichmentType, ProjectionOptions>) => string, required)
  - `toEnrichmentDefaults` ((args: ToEnrichmentsArgs) => EnrichmentType | undefined): Optional: compute the DEFAULT enrichment values for a model from its schema - the seed the CMS persists and the user then edits (vs the entry's `toEnrichments`, which READS already-authored values). Returns the `{ subject, generator, stack }` umbrella; a generator typically fills only `subject` and leaves the run-constant `generator` / `stack` scopes `undefined`. Omitted → the derived static returns `undefined`.

## Returns

`ModelProjectionBaseClass<EnrichmentType, IdType, ProjectionOptions>`
