"""UI Service - handles user interface formatting and display logic. This service contains all business logic for formatting data for display that was extracted from models during the migration from Discord app. """ import logging from .base_service import BaseService from ..models.team import Team class UIService(BaseService): """Service for user interface formatting and display logic.""" def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.logger = logging.getLogger(f'{__name__}.{self.__class__.__name__}') def format_team_display(self, team: Team) -> dict: """Format team for web display (extracted from Discord embed property). Args: team: Team model instance Returns: dict: Formatted team display data for web UI """ self._log_operation(f"Formatting team display for team {team.id}") try: # Constants from original Discord app SBA_COLOR = 'a6ce39' SBA_LOGO = 'https://paper-dynasty.s3.us-east-1.amazonaws.com/static-images/sba-logo.png' display_data = { 'title': team.lname, 'color': team.color if team.color else SBA_COLOR, 'footer_text': f'Paper Dynasty Season {team.season}', 'footer_icon': SBA_LOGO, 'thumbnail': team.logo if team.logo else SBA_LOGO, 'team_id': team.id, 'abbrev': team.abbrev, 'season': team.season } self.logger.info(f"Successfully formatted team display for {team.abbrev}") return display_data except Exception as e: self._log_error(f"format_team_display for team {team.id}", e) raise