"""ConnectWise implementation of PSAProvider.""" from __future__ import annotations from app.services.psa.base import PSAProvider from app.services.psa.types import ( ConnectionTestResult, PSATicket, PSANote, PSAStatus, PSACompany, PSAMember, PSAConfiguration, ) from .client import ConnectWiseClient class ConnectWiseProvider(PSAProvider): """ConnectWise PSA provider implementation.""" def __init__(self, client: ConnectWiseClient): self.client = client async def test_connection(self) -> ConnectionTestResult: """Test the CW connection by fetching system info.""" try: info = await self.client.get("/system/info") return ConnectionTestResult( success=True, message="Connected successfully.", server_version=info.get("version", None), ) except Exception as e: return ConnectionTestResult( success=False, message=str(e), server_version=None, ) # ── Stubs for Phase A slices 2-5 ───────────────────────────────── async def get_ticket(self, ticket_id: str) -> PSATicket: raise NotImplementedError("Implemented in Slice 2") async def search_tickets(self, query: str, **filters) -> list[PSATicket]: raise NotImplementedError("Implemented in Slice 3") async def post_note( self, ticket_id: str, text: str, note_type: str, member_id: str | None = None, ) -> PSANote: raise NotImplementedError("Implemented in Slice 4") async def update_ticket_status( self, ticket_id: str, status_id: int ) -> PSATicket: raise NotImplementedError("Implemented in Slice 4") async def get_ticket_statuses(self, board_id: int) -> list[PSAStatus]: raise NotImplementedError("Implemented in Slice 3") async def list_companies(self, **filters) -> list[PSACompany]: raise NotImplementedError("Implemented in Slice 3") async def get_company(self, company_id: str) -> PSACompany: raise NotImplementedError("Implemented in Slice 3") async def list_members(self) -> list[PSAMember]: raise NotImplementedError("Implemented in Slice 5") async def get_ticket_configurations( self, ticket_id: str ) -> list[PSAConfiguration]: raise NotImplementedError("Implemented in Slice 3")