"""
CLI framework core.

Provides the main CLI framework and command delegation.
"""

from .commands import WorkspaceCommands, IssueCommands, ProjectCommands, ExportCommands


class CLIFramework:
    """Main CLI framework that delegates to command classes."""

    def __init__(self):
        self.workspace = WorkspaceCommands()
        self.issues = IssueCommands()
        self.project = ProjectCommands()
        self.export = ExportCommands()

    # Workspace operations
    def workspace_status(self):
        return self.workspace.status()

    def start_issue(self, issue_number: int):
        return self.workspace.start_issue(issue_number)

    def finish_issue(self):
        return self.workspace.finish_issue()

    def add_test_guidance(self):
        return self.workspace.add_test_guidance()

    # Issue operations
    def list_issues(self):
        return self.issues.list_issues()

    def list_open_issues(self):
        return self.issues.list_open_issues()

    def show_issue(self, issue_number: int):
        return self.issues.show_issue(issue_number)

    def create_issue(self, title: str, body: str, issue_type: str = "enhancement"):
        return self.issues.create_issue(title, body, issue_type)

    def create_enhancement_issue(self, title: str, use_case: str, **kwargs):
        return self.issues.create_enhancement_issue(title, use_case, **kwargs)

    def create_from_template(self, template_file: str, **kwargs):
        return self.issues.create_from_template(template_file, **kwargs)

    def analyze_coverage(self, issue_number: int):
        return self.issues.analyze_coverage(issue_number)

    # Project management operations
    def setup_project_management(self):
        return self.project.setup_project_management()

    def move_issue_to_state(self, issue_number: int, state: str):
        return self.project.move_issue_to_state(issue_number, state)

    def set_issue_priority(self, issue_number: int, priority: str):
        return self.project.set_issue_priority(issue_number, priority)

    def create_milestone(self, title: str, description: str = ""):
        return self.project.create_milestone(title, description)

    def list_milestones(self):
        return self.project.list_milestones()

    def assign_issue_to_milestone(self, issue_number: int, milestone_id: int):
        return self.project.assign_issue_to_milestone(issue_number, milestone_id)

    def project_overview(self):
        return self.project.project_overview()

    # Export operations
    def issue_index(self, **kwargs):
        return self.export.issue_index(**kwargs)