"""Markdown templates for each ComponentType used by DocRenderer."""

from __future__ import annotations

# ---------------------------------------------------------------------------
# Template strings keyed by ComponentType.value
#
# Placeholders use Python str.format() / f-string style: {name}
# Lists and tables are generated by the renderer and injected as pre-built
# markdown strings.
# ---------------------------------------------------------------------------

MODULE_TEMPLATE = """\
# {title}

{summary}

## Module Info

| Property | Value |
|----------|-------|
| Path | `{path}` |
| Lines | {lines} |
| Classes | {class_count} |
| Functions | {function_count} |

## Classes

{classes_table}

## Functions

{functions_table}

## Dependencies

{imports_list}

## Dependency Diagram

```mermaid
graph LR
{dependency_diagram}
```

## See Also

{see_also}
"""

COMMAND_TEMPLATE = """\
# {title}

{summary}

## Usage

```bash
{usage}
```

## Options

{options_table}

## Examples

{examples}

## Workflow Diagram

```mermaid
graph TD
{workflow_diagram}
```

## See Also

{see_also}
"""

CONFIG_TEMPLATE = """\
# {title}

{summary}

## Options

| Key | Type | Default | Description |
|-----|------|---------|-------------|
{options_rows}

## Example Configuration

```yaml
{example_config}
```

## Environment Variables

{env_vars}

## See Also

{see_also}
"""

TYPES_TEMPLATE = """\
# {title}

{summary}

## Type Definitions

{type_defs_table}

## Enums

{enums_table}

## TypedDicts / Dataclasses

{dataclass_details}

## Class Diagram

```mermaid
classDiagram
{class_diagram}
```

## See Also

{see_also}
"""

API_TEMPLATE = """\
# {title}

{summary}

## Endpoints

{endpoints_table}

## Request / Response Schemas

{schemas}

## Authentication

{authentication}

## See Also

{see_also}
"""

# Canonical mapping from ComponentType name to template string.
TEMPLATES: dict[str, str] = {
    "MODULE": MODULE_TEMPLATE,
    "COMMAND": COMMAND_TEMPLATE,
    "CONFIG": CONFIG_TEMPLATE,
    "TYPES": TYPES_TEMPLATE,
    "API": API_TEMPLATE,
}
