from typing import List, Optional
from sqlmodel.ext.asyncio.session import AsyncSession
from app.cruds import {{ model.module_name }} as crud
from app.schemas.{{ model.module_name }} import {{ model.name }}Create, {{ model.name }}Update
from app.models.{{ model.module_name }} import {{ model.name }}

class {{ model.name }}Service:
    async def get(self, session: AsyncSession, id: int) -> Optional[{{ model.name }}]:
        return await crud.get(session, id)

    async def get_multi(self, session: AsyncSession, skip: int = 0, limit: int = 100) -> List[{{ model.name }}]:
        return await crud.get_multi(session, skip=skip, limit=limit)

    async def create(self, session: AsyncSession, obj_in: {{ model.name }}Create) -> {{ model.name }}:
        return await crud.create(session, obj_in)

    async def update(self, session: AsyncSession, db_obj: {{ model.name }}, obj_in: {{ model.name }}Update) -> {{ model.name }}:
        return await crud.update(session, db_obj, obj_in)

    async def delete(self, session: AsyncSession, id: int) -> {{ model.name }}:
        return await crud.delete(session, id)

service = {{ model.name }}Service()
