"""
Fh API namespace.

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

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

from ._base import AsyncBaseAPI, BaseAPI


class FhAPI(BaseAPI):
    """Fh namespace: financials, history, info, latest, load, metrics, quality."""

    def financials(
        self,
        *,
        identifiers: Union[str, List[str]],
        statement: Optional[str] = "all",
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Get financials

        Income statement, balance sheet, cash flow.

        Args:
        identifiers: List of TepiloraCodes
        statement: income|balance|cashflow|all"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if statement is not None:
            params["statement"] = statement
        return self._call("fh.financials", params=params, options=options, context=context, response_format=response_format)

    def history(
        self,
        *,
        identifiers: Union[str, List[str]],
        columns: Optional[List[Any]] = None,
        start_date: Optional[str] = None,
        end_date: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Get fundamentals history

        Historical fundamental data.

        Args:
        identifiers: List of TepiloraCodes
        columns: Columns to return
        start_date: Start date (YYYY-MM-DD)
        end_date: End date (YYYY-MM-DD)"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if columns is not None:
            params["columns"] = columns
        if start_date is not None:
            params["start_date"] = start_date
        if end_date is not None:
            params["end_date"] = end_date
        return self._call("fh.history", params=params, options=options, context=context, response_format=response_format)

    def info(
        self,
        *,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Column info

        Get information about available columns."""
        params: Dict[str, Any] = {}
        return self._call("fh.info", params=params, options=options, context=context)

    def latest(
        self,
        *,
        identifiers: Union[str, List[str]],
        columns: Optional[List[Any]] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Get latest fundamentals

        Get most recent fundamental data.

        Args:
        identifiers: List of TepiloraCodes
        columns: Columns to return"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if columns is not None:
            params["columns"] = columns
        return self._call("fh.latest", params=params, options=options, context=context, response_format=response_format)

    def load(
        self,
        *,
        identifiers: Union[str, List[str]],
        columns: Optional[List[Any]] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Load fundamentals

        Load fundamental data for securities.

        Args:
        identifiers: List of TepiloraCodes
        columns: Columns to load"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if columns is not None:
            params["columns"] = columns
        return self._call("fh.load", params=params, options=options, context=context, response_format=response_format)

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

        Pre-calculated metrics (ROE, margins, etc.).

        Args:
        identifiers: List of TepiloraCodes
        metrics: Metric groups: margins|profitability|leverage|efficiency|growth"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if metrics is not None:
            params["metrics"] = metrics
        return self._call("fh.metrics", params=params, options=options, context=context, response_format=response_format)

    def quality(
        self,
        *,
        identifiers: Union[str, List[str]],
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Quality score

        Calculate quality score (0-100).

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



class AsyncFhAPI(AsyncBaseAPI):
    """Fh namespace: financials, history, info, latest, load, metrics, quality."""

    async def financials(
        self,
        *,
        identifiers: Union[str, List[str]],
        statement: Optional[str] = "all",
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Get financials

        Income statement, balance sheet, cash flow.

        Args:
        identifiers: List of TepiloraCodes
        statement: income|balance|cashflow|all"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if statement is not None:
            params["statement"] = statement
        return await self._call("fh.financials", params=params, options=options, context=context, response_format=response_format)

    async def history(
        self,
        *,
        identifiers: Union[str, List[str]],
        columns: Optional[List[Any]] = None,
        start_date: Optional[str] = None,
        end_date: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Get fundamentals history

        Historical fundamental data.

        Args:
        identifiers: List of TepiloraCodes
        columns: Columns to return
        start_date: Start date (YYYY-MM-DD)
        end_date: End date (YYYY-MM-DD)"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if columns is not None:
            params["columns"] = columns
        if start_date is not None:
            params["start_date"] = start_date
        if end_date is not None:
            params["end_date"] = end_date
        return await self._call("fh.history", params=params, options=options, context=context, response_format=response_format)

    async def info(
        self,
        *,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Column info

        Get information about available columns."""
        params: Dict[str, Any] = {}
        return await self._call("fh.info", params=params, options=options, context=context)

    async def latest(
        self,
        *,
        identifiers: Union[str, List[str]],
        columns: Optional[List[Any]] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Get latest fundamentals

        Get most recent fundamental data.

        Args:
        identifiers: List of TepiloraCodes
        columns: Columns to return"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if columns is not None:
            params["columns"] = columns
        return await self._call("fh.latest", params=params, options=options, context=context, response_format=response_format)

    async def load(
        self,
        *,
        identifiers: Union[str, List[str]],
        columns: Optional[List[Any]] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Load fundamentals

        Load fundamental data for securities.

        Args:
        identifiers: List of TepiloraCodes
        columns: Columns to load"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if columns is not None:
            params["columns"] = columns
        return await self._call("fh.load", params=params, options=options, context=context, response_format=response_format)

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

        Pre-calculated metrics (ROE, margins, etc.).

        Args:
        identifiers: List of TepiloraCodes
        metrics: Metric groups: margins|profitability|leverage|efficiency|growth"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if metrics is not None:
            params["metrics"] = metrics
        return await self._call("fh.metrics", params=params, options=options, context=context, response_format=response_format)

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

        Calculate quality score (0-100).

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


