# generated by fastapi-codegen:
#   filename:  connector
#   timestamp: 2026-04-01T10:27:26+00:00

from __future__ import annotations

from typing import Annotated

from fastapi import APIRouter, Depends, HTTPException
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer

from centra_sdk.utils.gc_handler import GcHandler
from centra_sdk.utils.handler_registry import HandlerRegistry

from ..dependencies import *

router = APIRouter(tags=['SwitchObservability'])
security = HTTPBearer(auto_error=False)
registry = HandlerRegistry()


@registry.register()
class SwitchObservabilityHandler(GcHandler):

    async def get_switch_observability(
        self,
        cursor: Optional[conint(ge=0)] = 0,
        page_size: Optional[conint(ge=1, le=1000)] = 100,
    ) -> SwitchObservability:
        """This method should be implemented by the subclass."""
        raise HTTPException(
            status_code=404, detail=f"get_switch_observability not implemented"
        )


@router.get(
    '/v1/provider/switch-observability',
    response_model=SwitchObservability,
    tags=['SwitchObservability'],
)
async def get_switch_observability(
    credentials: Annotated[HTTPAuthorizationCredentials, Depends(security)],
    cursor: Optional[conint(ge=0)] = 0,
    page_size: Optional[conint(ge=1, le=1000)] = 100,
) -> SwitchObservability:
    """
    Retrieve switch observability data
    """

    token = credentials.credentials if credentials else None
    return await registry.call_handler(
        get_switch_observability.__name__, token, cursor, page_size
    )


__all__ = ['SwitchObservabilityHandler', 'registry']
