"""Type definitions for {{ module_name }}.

This module contains all Pydantic models, settings, and type definitions
for the {{ module_name }} module.

Generated by: madsci new module --template module/basic
Template version: {{ template_version }}
"""

from typing import Literal, Optional

from madsci.node_module import RestNodeConfig
from pydantic import BaseModel, Field


class {{ module_name | pascal_case }}NodeConfig(RestNodeConfig):
    """Configuration for the {{ module_name | pascal_case }} node.

    This class defines all configuration options for the node.
    Values can be set via environment variables, config files, or programmatically.
    """

    # Server configuration
    node_url: str = Field(
        default="http://localhost:{{ port }}/",
        description="URL where the node REST API is served",
    )

    # Interface configuration
    interface_type: Literal["real", "fake"] = Field(
        default="real",
        description="Which interface to use (real or fake)",
    )

    # Add your device-specific configuration here
    # device_address: str = Field(
    #     default="192.168.1.100",
    #     description="IP address or hostname of the device",
    # )
    # device_timeout: float = Field(
    #     default=30.0,
    #     description="Timeout for device operations in seconds",
    # )


class {{ module_name | pascal_case }}InterfaceConfig(BaseModel):
    """Configuration for the {{ module_name | pascal_case }} interface.

    This class defines settings specific to the hardware interface.
    """

    # Add your interface-specific configuration here
    # connection_timeout: float = Field(
    #     default=10.0,
    #     description="Timeout for establishing connection",
    # )
    # retry_count: int = Field(
    #     default=3,
    #     description="Number of retries for failed operations",
    # )
    pass


class {{ module_name | pascal_case }}Command(BaseModel):
    """Command to send to the {{ module_name }} device.

    Use this model to define the structure of commands sent to the device.
    """

    action: str = Field(description="Action to perform")
    parameters: dict = Field(
        default_factory=dict,
        description="Optional parameters for the action",
    )


class {{ module_name | pascal_case }}Result(BaseModel):
    """Result from a {{ module_name }} device operation.

    Use this model to define the structure of results from device operations.
    """

    success: bool = Field(description="Whether the operation succeeded")
    data: Optional[dict] = Field(
        default=None,
        description="Result data from the operation",
    )
    error_message: Optional[str] = Field(
        default=None,
        description="Error message if operation failed",
    )
