"""Time-specific utilities and calculations.

This module handles time-related operations and conversions.
"""

from datetime import datetime, time
from typing import Dict


class TimeUtil:
    """Utilities for time operations."""

    @staticmethod
    def current_time() -> time:
        """Get current time.

        Returns:
            Current time object
        """
        return datetime.now().time()

    @staticmethod
    def seconds_to_hms(seconds: int) -> Dict[str, int]:
        """Convert seconds to hours, minutes, seconds.

        Args:
            seconds: Total seconds

        Returns:
            Dictionary with 'hours', 'minutes', 'seconds' keys
        """
        hours = seconds // 3600
        remaining = seconds % 3600
        minutes = remaining // 60
        secs = remaining % 60

        return {
            "hours": hours,
            "minutes": minutes,
            "seconds": secs,
        }

    @staticmethod
    def hms_to_seconds(hours: int, minutes: int = 0, seconds: int = 0) -> int:
        """Convert hours, minutes, seconds to total seconds.

        Args:
            hours: Hours component
            minutes: Minutes component (default 0)
            seconds: Seconds component (default 0)

        Returns:
            Total seconds
        """
        return hours * 3600 + minutes * 60 + seconds

    @staticmethod
    def is_24_hour_format(hour: int) -> bool:
        """Check if hour is valid in 24-hour format.

        Args:
            hour: The hour value to check

        Returns:
            True if 0-23, False otherwise
        """
        return 0 <= hour <= 23
