"""Template repository port (Protocol)."""

from __future__ import annotations

from typing import List, Optional, Protocol

from packages.domain.template import Template, TemplateCategory, TemplateSegment


class TemplateRepositoryPort(Protocol):
    def list_by_user(self, user_id: str, *, skip: int = 0, limit: int = 50) -> List[Template]: ...
    def get(self, template_id: str, user_id: str) -> Optional[Template]: ...
    def create(self, template: Template) -> Template: ...
    def update(self, template: Template) -> Template: ...
    def delete(self, template_id: str, user_id: str) -> bool: ...
    def count_by_user(self, user_id: str) -> int: ...
    def list_segments(self, template_id: str) -> List[TemplateSegment]: ...
    def create_segments(self, segments: List[TemplateSegment]) -> List[TemplateSegment]: ...
    def delete_segments_by_template(self, template_id: str) -> int: ...
    def list_categories(self, user_id: str) -> List[TemplateCategory]: ...
    def create_category(self, category: TemplateCategory) -> TemplateCategory: ...
    def get_category(self, category_id: str, user_id: str) -> Optional[TemplateCategory]: ...
    def delete_category(self, category_id: str, user_id: str) -> bool: ...
