from typing import List, Optional, Dict, Any

from app.{{ name }}.domain.repositories.{{ name }}_repository import {{ pascal_case }}Repository
from app.{{ name }}.domain.entities.{{ name }} import {{ pascal_case }}

class {{ pascal_case }}Service:
    def __init__(self, repository: {{ pascal_case }}Repository):
        self.repository = repository

    def list(self,
            trashed: int,
            paginate: int,
            page: int,
            rows: int,
            filters: Optional[Dict[str, Any]] = None
        ) -> List[{{ pascal_case }}]:
        return self.repository.all(trashed, paginate, page, rows, filters)

    def search(self, id: str) -> Optional[{{ pascal_case }}]:
        return self.repository.find(id)

    def save(self, {{ name }}: {{ pascal_case }}) -> {{ pascal_case }}:
        return self.repository.create({{ name }})

    def modify(self, id: str, {{ name }}: {{ pascal_case }}) -> Optional[{{ pascal_case }}]:
        return self.repository.update(id, {{ name }})

    def remove(self, id: str) -> Optional[{{ pascal_case }}]:
        return self.repository.delete(id)