"""{{ feature_name | capitalize }} business logic.

This module contains service functions that implement the core
business logic for the {{ feature_name }} feature.

Services should:
    - Contain all business logic
    - Use the database session passed to them
    - Raise featureropriate exceptions from core.exceptions
    - Return domain objects or None
"""

from sqlalchemy.ext.asyncio import AsyncSession

# from sqlalchemy import select
# from core.exceptions import NotFoundError
# from {{ feature_name }}.models import {{ feature_name | capitalize }}
# from {{ feature_name }}.schemas import {{ feature_name | capitalize }}Create, {{ feature_name | capitalize }}Update


# Example service functions:
#
# async def get_{{ feature_name }}(db: AsyncSession, {{ feature_name }}_id: int) -> {{ feature_name | capitalize }}:
#     """Get a {{ feature_name }} by ID.
#
#     Args:
#         db: Database session.
#         {{ feature_name }}_id: The {{ feature_name }} ID.
#
#     Returns:
#         The {{ feature_name }} object.
#
#     Raises:
#         NotFoundError: If the {{ feature_name }} is not found.
#     """
#     result = await db.execute(
#         select({{ feature_name | capitalize }}).where({{ feature_name | capitalize }}.id == {{ feature_name }}_id)
#     )
#     {{ feature_name }} = result.scalar_one_or_none()
#     if not {{ feature_name }}:
#         raise NotFoundError(f"{{ feature_name | capitalize }} with id {{ '{' }}{{ feature_name }}_id{{ '}' }} not found")
#     return {{ feature_name }}
#
#
# async def create_{{ feature_name }}(db: AsyncSession, data: {{ feature_name | capitalize }}Create) -> {{ feature_name | capitalize }}:
#     """Create a new {{ feature_name }}.
#
#     Args:
#         db: Database session.
#         data: The {{ feature_name }} data.
#
#     Returns:
#         The created {{ feature_name }} object.
#     """
#     {{ feature_name }} = {{ feature_name | capitalize }}(**data.model_dump())
#     db.add({{ feature_name }})
#     await db.flush()
#     return {{ feature_name }}
