"""
Esg API namespace.

AUTO-GENERATED by scripts/generate_sdk.py - DO NOT EDIT MANUALLY!
Regenerate with: python scripts/generate_sdk.py --category esg
"""
from __future__ import annotations

from typing import Any, Dict, List, Optional, Union

from ._base import AsyncBaseAPI, BaseAPI


class EsgAPI(BaseAPI):
    """Esg namespace: compare, get, portfolio, scores, screen, summary."""

    def compare(
        self,
        *,
        portfolios: List[Any],
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Compare ESG

        Compare ESG scores across portfolios.

        Args:
        portfolios: List of portfolio weights dicts"""
        params: Dict[str, Any] = {}
        params["portfolios"] = portfolios
        return self._call("esg.compare", params=params, options=options, context=context)

    def get(
        self,
        *,
        identifiers: Union[str, List[str]],
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get ESG data

        Get ESG scores for securities.

        Args:
        identifiers: List of TepiloraCodes"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        return self._call("esg.get", params=params, options=options, context=context)

    def portfolio(
        self,
        *,
        id: str,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Portfolio ESG

        Calculate weighted ESG score for portfolio.

        Args:
        id: Portfolio ID"""
        params: Dict[str, Any] = {}
        params["id"] = id
        return self._call("esg.portfolio", params=params, options=options, context=context)

    def scores(
        self,
        *,
        identifiers: Union[str, List[str]],
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get ESG scores (alias of esg.get)

        Alias for esg.get. Use esg.get instead.

        Args:
        identifiers: List of TepiloraCodes"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        return self._call("esg.scores", params=params, options=options, context=context)

    def screen(
        self,
        *,
        universe: Optional[List[Any]] = None,
        min_sri: Optional[int] = None,
        max_sri: Optional[int] = None,
        min_esg_score: Optional[float] = None,
        sfdr_filter: Optional[str] = None,
        limit: Optional[int] = 100,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """ESG screen

        Screen securities by ESG criteria.

        Args:
        universe: Universe of identifiers
        min_sri: Minimum SRI score
        max_sri: Maximum SRI score
        min_esg_score: Minimum ESG score
        sfdr_filter: SFDR filter
        limit: Maximum results"""
        params: Dict[str, Any] = {}
        if universe is not None:
            params["universe"] = universe
        if min_sri is not None:
            params["min_sri"] = min_sri
        if max_sri is not None:
            params["max_sri"] = max_sri
        if min_esg_score is not None:
            params["min_esg_score"] = min_esg_score
        if sfdr_filter is not None:
            params["sfdr_filter"] = sfdr_filter
        if limit is not None:
            params["limit"] = limit
        return self._call("esg.screen", params=params, options=options, context=context, response_format=response_format)

    def summary(
        self,
        *,
        identifiers: Optional[Union[str, List[str]]] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """ESG summary

        Aggregated ESG statistics.

        Args:
        identifiers: List of TepiloraCodes"""
        params: Dict[str, Any] = {}
        if identifiers is not None:
            params["identifiers"] = identifiers
        return self._call("esg.summary", params=params, options=options, context=context)



class AsyncEsgAPI(AsyncBaseAPI):
    """Esg namespace: compare, get, portfolio, scores, screen, summary."""

    async def compare(
        self,
        *,
        portfolios: List[Any],
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Compare ESG

        Compare ESG scores across portfolios.

        Args:
        portfolios: List of portfolio weights dicts"""
        params: Dict[str, Any] = {}
        params["portfolios"] = portfolios
        return await self._call("esg.compare", params=params, options=options, context=context)

    async def get(
        self,
        *,
        identifiers: Union[str, List[str]],
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get ESG data

        Get ESG scores for securities.

        Args:
        identifiers: List of TepiloraCodes"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        return await self._call("esg.get", params=params, options=options, context=context)

    async def portfolio(
        self,
        *,
        id: str,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Portfolio ESG

        Calculate weighted ESG score for portfolio.

        Args:
        id: Portfolio ID"""
        params: Dict[str, Any] = {}
        params["id"] = id
        return await self._call("esg.portfolio", params=params, options=options, context=context)

    async def scores(
        self,
        *,
        identifiers: Union[str, List[str]],
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get ESG scores (alias of esg.get)

        Alias for esg.get. Use esg.get instead.

        Args:
        identifiers: List of TepiloraCodes"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        return await self._call("esg.scores", params=params, options=options, context=context)

    async def screen(
        self,
        *,
        universe: Optional[List[Any]] = None,
        min_sri: Optional[int] = None,
        max_sri: Optional[int] = None,
        min_esg_score: Optional[float] = None,
        sfdr_filter: Optional[str] = None,
        limit: Optional[int] = 100,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """ESG screen

        Screen securities by ESG criteria.

        Args:
        universe: Universe of identifiers
        min_sri: Minimum SRI score
        max_sri: Maximum SRI score
        min_esg_score: Minimum ESG score
        sfdr_filter: SFDR filter
        limit: Maximum results"""
        params: Dict[str, Any] = {}
        if universe is not None:
            params["universe"] = universe
        if min_sri is not None:
            params["min_sri"] = min_sri
        if max_sri is not None:
            params["max_sri"] = max_sri
        if min_esg_score is not None:
            params["min_esg_score"] = min_esg_score
        if sfdr_filter is not None:
            params["sfdr_filter"] = sfdr_filter
        if limit is not None:
            params["limit"] = limit
        return await self._call("esg.screen", params=params, options=options, context=context, response_format=response_format)

    async def summary(
        self,
        *,
        identifiers: Optional[Union[str, List[str]]] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """ESG summary

        Aggregated ESG statistics.

        Args:
        identifiers: List of TepiloraCodes"""
        params: Dict[str, Any] = {}
        if identifiers is not None:
            params["identifiers"] = identifiers
        return await self._call("esg.summary", params=params, options=options, context=context)


