# {{ module_name | pascal_case }} Module

{{ module_description }}

Generated by MADSci template: `module/basic` v{{ template_version }}

## Overview

This module provides a MADSci node for controlling the {{ module_name }} device.

## Project Structure

```
{{ module_name }}_module/
├── src/
│   ├── {{ module_name }}_rest_node.py     # MADSci REST node server
│   ├── {{ module_name }}_interface.py     # Real hardware interface
│   ├── {{ module_name }}_fake_interface.py # Fake interface for testing
│   └── {{ module_name }}_types.py         # Type definitions and config
├── tests/
│   └── test_{{ module_name }}_interface.py
├── Dockerfile
├── pyproject.toml
└── README.md
```

## Quick Start

### Installation

```bash
# Install in development mode
pip install -e ".[dev]"
```

### Running with Fake Interface (Testing)

```bash
# Start the node with fake interface (no hardware required)
python src/{{ module_name }}_rest_node.py --fake

# Verify it's running
curl http://localhost:{{ port }}/health
```

### Running with Real Interface

```bash
# Start the node with real interface
python src/{{ module_name }}_rest_node.py
```

### Using the Interface Directly

The interface can be used independently of MADSci:

```python
from {{ module_name }}_interface import {{ module_name | pascal_case }}Interface

# Create and connect
interface = {{ module_name | pascal_case }}Interface()
interface.connect()

# Perform operations
result = interface.do_something("Hello")
print(result)

# Clean up
interface.disconnect()
```

## Testing

```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=src
```

## Development

### Interface Development

1. Edit `src/{{ module_name }}_interface.py` to implement hardware communication
2. Update the fake interface to match new behavior
3. Add tests in `tests/test_{{ module_name }}_interface.py`

### Adding Actions

1. Add interface methods in `{{ module_name }}_interface.py`
2. Add corresponding methods in `{{ module_name }}_fake_interface.py`
3. Create action handlers in `{{ module_name }}_rest_node.py`

## Docker

```bash
# Build the image
docker build -t {{ module_name }}-module .

# Run with fake interface
docker run -p {{ port }}:{{ port }} {{ module_name }}-module --fake
```

## Documentation

For more information, see the [MADSci documentation](https://ad-sdl.github.io/MADSci/).
