#/app/aroflo_connector_app/zones/timesheets/__init__.py
from __future__ import annotations

from typing import Any, Dict, List, Optional

from ..base import Zone, ZoneOperation

from . import base as base_section
from . import mutations as mutations_section

SECTIONS = [
    base_section,
    mutations_section,
]


class TimesheetsZone(Zone):
    code = "timesheets"
    label = "Timesheets"
    description = "Zona Timesheets de AroFlo (lecturas por usuario/tarea/tipo y filtros por fecha)."

    @property
    def operations(self) -> List[ZoneOperation]:
        ops: List[ZoneOperation] = []
        for s in SECTIONS:
            ops.extend(s.get_operations())
        return ops

    def execute(self, operation_code: str, params: Optional[Dict[str, Any]] = None) -> Any:
        params = params or {}
        for s in SECTIONS:
            if s.supports(operation_code):
                return s.execute(operation_code, self.client, params)
        raise ValueError(f"[Timesheets] Operación no soportada: {operation_code}")
