# Class: {{ gen.name(element) }}

{%- if header -%}
{{header}}
{%- endif -%}


{% if element.description %}
_{{ element.description }}_
{% endif %}

{% if element.abstract %}
* __NOTE__: this is an abstract class and should not be instantiated directly
{% endif %}

URI: {{ gen.uri_link(element) }}

{% include "class_diagram.md.jinja2" %}

{% if schemaview.class_parents(element.name) or schemaview.class_children(element.name, mixins=False) %}

## Inheritance
{{ gen.inheritance_tree(element, mixins=True) }}
{% else %}
<!-- no inheritance hierarchy -->
{% endif %}

## Slots

| Name | Cardinality and Range | Description | Inheritance |
| ---  | --- | --- | --- |
{% if gen.get_direct_slots(element)|length > 0 %}
{%- for slot in gen.get_direct_slots(element) -%}
| {{ gen.link(slot) }} | {{ gen.cardinality(slot) }} <br/> {{ gen.link(slot.range) }} | {{ slot.description|enshorten }} | direct |
{% endfor -%}
{% endif -%}
{% if gen.get_indirect_slots(element)|length > 0 %}
{%- for slot in gen.get_indirect_slots(element) -%}
| {{ gen.link(slot) }} | {{ gen.cardinality(slot) }} <br/> {{ gen.link(slot.range) }} | {{ slot.description|enshorten }} | {{ gen.links(gen.get_slot_inherited_from(element.name, slot.name))|join(', ') }} |
{% endfor -%}
{% endif %}

{% if schemaview.is_mixin(element.name) %}
## Mixin Usage

| mixed into | description |
| --- | --- |
{% for c in schemaview.class_children(element.name, is_a=False) -%}
| {{ gen.link(c) }} | {{ schemaview.get_class(c).description|enshorten }} |
{% endfor %}
{% endif %}

{% if schemaview.usage_index().get(element.name) %}
## Usages

| used by | used in | type | used |
| ---  | --- | --- | --- |
{% for usage in schemaview.usage_index().get(element.name) -%}
| {{gen.link(usage.used_by)}} | {{gen.link(usage.slot)}} | {{usage.metaslot}} | {{ gen.link(usage.used) }} |
{% endfor %}
{% endif %}

{% include "common_metadata.md.jinja2" %}


{% if schemaview.get_mappings(element.name).items() -%}
## Mappings

| Mapping Type | Mapped Value |
| ---  | ---  |
{% for m, mt in schemaview.get_mappings(element.name).items() -%}
{% if mt|length > 0 -%}
| {{ m }} | {{ mt|join(', ') }} |
{% endif -%}
{% endfor %}

{% endif -%}

{% if gen.example_object_blobs(element.name) -%}
## Examples
{% for name, blob in gen.example_object_blobs(element.name) -%}
### Example: {{name}}

```yaml
{{ blob }}
```
{% endfor %}
{% endif %}


## LinkML Source

<!-- TODO: investigate https://stackoverflow.com/questions/37606292/how-to-create-tabbed-code-blocks-in-mkdocs-or-sphinx -->

### Direct

<details>
```yaml
{{gen.yaml(element)}}
```
</details>

### Induced

<details>
```yaml
{{gen.yaml(element, inferred=True)}}
```
</details>

{%- if footer -%}
{{footer}}
{%- endif -%}