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

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

logger = logging.getLogger(__name__)


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

    def __init__(self, serviceCenter=None):
        """Initialize ticket service with service center access.

        Args:
            serviceCenter: Service center instance for accessing other services
        """
        self.services = serviceCenter

    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.

        Args:
            taskSyncDefinition: Field mapping definition for ticket synchronization
            connectorType: Type of connector (e.g., "Jira", "ServiceNow")
            connectorParams: Optional parameters for the connector

        Returns:
            Ticket interface instance
        """
        return await createTicketInterfaceByType(
            taskSyncDefinition=taskSyncDefinition,
            connectorType=connectorType,
            connectorParams=connectorParams
        )
