# event_type_handler.py from datetime import datetime from typing import List, Dict, Tuple from calendar_entry import CalendarEntry from config import EventConfig from date_service import DateService class EventTypeHandler: """Handles event type-specific business rules and categorization""" @staticmethod def get_duration_for_type(event_type: str, start_date: datetime) -> datetime: """Calculate end date for event type based on business rules""" if event_type == "EZ pauschal": return start_date + EventConfig.get_ez_pauschal_duration() else: # For other types, duration is determined by user input return start_date @staticmethod def categorize_events(entries: List[CalendarEntry]) -> Dict[str, List[Tuple[datetime, datetime, str]]]: """Categorize calendar entries by type for processing""" categorized = {} for entry in entries: if entry.keyword not in categorized: categorized[entry.keyword] = [] categorized[entry.keyword].append(( entry.start_date, entry.end_date, entry.id )) return categorized @staticmethod def validate_event_type(event_type: str) -> bool: """Validate that event type is supported""" return EventConfig.is_valid_keyword(event_type) @staticmethod def get_event_type_display_name(event_type: str) -> str: """Get display name for event type""" return event_type @staticmethod def calculate_accounted_time(entry: CalendarEntry) -> str: """Deprecated: accounted time is computed and stored elsewhere.""" return "" @staticmethod def should_hide_end_date_input(event_type: str) -> bool: """Determine if end date input should be hidden for this event type""" return event_type == "EZ pauschal" @staticmethod def get_event_type_description(event_type: str) -> str: """Deprecated: display descriptions removed for lean runtime.""" return "" @staticmethod def get_processing_order() -> List[str]: """Deprecated: processing order is defined inline where needed.""" return ["EZ 100%", "EZ 50%", "EZ pauschal", "Sonstige"] @staticmethod def is_full_time_event(event_type: str) -> bool: """Deprecated helper kept for compatibility.""" return event_type in ["EZ 100%", "EZ pauschal"] @staticmethod def is_part_time_event(event_type: str) -> bool: """Deprecated helper kept for compatibility.""" return event_type == "EZ 50%" @staticmethod def is_other_event(event_type: str) -> bool: """Deprecated helper kept for compatibility.""" return event_type == "Sonstige"