from mcp.server.mcpserver.exceptions import ToolError
from pygittools.tasks import Task


class BoardNotFoundError(ToolError):
    def __init__(self, board_name: str):
        self.board_name = board_name
        super().__init__(f"Board {board_name} not found")


class TaskNotFoundError(ToolError):
    def __init__(self, task_ref: str):
        self.task_ref = task_ref
        super().__init__(f"Task {task_ref} not found")


class InvalidTaskStatusError(ToolError):
    def __init__(self, value: str):
        self.value = value
        self.valid_values = [item.value for item in Task.Status]
        super().__init__(
            f"Invalid task status value, {value}. Valid task status values: ({','.join(self.valid_values)})"
        )


class InvalidTaskPriorityError(ToolError):
    def __init__(self, value: str):
        self.value = value
        self.valid_values = [item.value for item in Task.Priority]
        super().__init__(
            f"Invalid task priority value, {value}. Valid task priority values: ({','.join(self.valid_values)})"
        )


class InvalidTaskDueDateError(ToolError):
    def __init__(self, dt: str):
        super().__init__(f"Invalid due date string, {dt}. Due dates must me an iso8601 timestamp")