# Copyright (c) 2025 Patrick Motsch
# All rights reserved.
"""Ticket service for creating ticket interfaces."""

import logging
from typing import Dict, Any, Optional, Callable
from modules.interfaces.interfaceTicketObjects import createTicketInterfaceByType

logger = logging.getLogger(__name__)


class TicketService:
    """Service class for ticket interface operations."""

    def __init__(self, context, get_service: Callable[[str], Any]):
        """Initialize with context and service resolver."""
        self._context = context
        self._get_service = get_service

    async def connectTicket(
        self,
        taskSyncDefinition: Dict[str, Any],
        connectorType: str,
        connectorParams: Optional[Dict[str, Any]] = None
    ):
        """Create a ticket interface by type with the given parameters."""
        return await createTicketInterfaceByType(
            taskSyncDefinition=taskSyncDefinition,
            connectorType=connectorType,
            connectorParams=connectorParams
        )
