"""Static display for cheatly - render once and exit."""

from rich.console import Console

from ..core.display import View


class StaticDisplay:
    """Display that renders once and exits."""

    def __init__(self, console: Console | None = None) -> None:
        """Initialize static display.

        Args:
            console: Rich console to use
        """
        self.console = console or Console()

    def show(self, view: View) -> None:
        """Show the view once.

        Args:
            view: View to display
        """
        if view.header:
            self.console.print(view.header)

        for item in view.content:
            self.console.print(item)

        if view.footer:
            self.console.print(view.footer)
