"""ORB Scanner API endpoints."""
from __future__ import annotations

from fastapi import APIRouter

from apps.web import orb_scanner_service as svc

router = APIRouter(prefix="/orb-scanner", tags=["orb-scanner"])


@router.post("/check", response_model=svc.OrbCheckResponse)
async def check(req: svc.OrbCheckRequest) -> svc.OrbCheckResponse:
    return await svc.check(req)


@router.post("/exit-check", response_model=svc.OrbExitCheckResponse)
async def exit_check(req: svc.OrbExitCheckRequest) -> svc.OrbExitCheckResponse:
    return await svc.exit_check(req)


@router.get("/strategies", response_model=svc.StrategiesResponse)
async def strategies() -> svc.StrategiesResponse:
    return svc.StrategiesResponse(
        strategies=svc.list_strategies(),
        default=svc._ORB_DEFAULT_STRATEGY,
    )


@router.get("/gainers-scan", response_model=svc.GainersScanResponse)
async def gainers_scan(count: int = 200, strategy: str | None = None) -> svc.GainersScanResponse:
    return await svc.gainers_scan(count, strategy)
