File size: 1,044 Bytes
c1e08a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Factory class for creating melody practice applications."""

from improvisation_lab.application.melody_practice.console_app import \
    ConsoleMelodyPracticeApp
from improvisation_lab.application.melody_practice.web_app import \
    WebMelodyPracticeApp
from improvisation_lab.config import Config
from improvisation_lab.service import MelodyPracticeService


class MelodyPracticeAppFactory:
    """Factory class for creating melody practice applications."""

    @staticmethod
    def create_app(app_type: str, service: MelodyPracticeService, config: Config):
        """Create a melody practice application.

        Args:
            app_type: Type of application to create.
            service: MelodyPracticeService instance.
            config: Config instance.
        """
        if app_type == "web":
            return WebMelodyPracticeApp(service, config)
        elif app_type == "console":
            return ConsoleMelodyPracticeApp(service, config)
        else:
            raise ValueError(f"Unknown app type: {app_type}")