# app/src/integrations/exchange/private_client.py

from __future__ import annotations

from src.core.config import load_settings
from src.integrations.exchange.auth import ExchangeAuth
from src.integrations.exchange.rest_client import ExchangeRestClient


class ExchangePrivateClient:
    def __init__(self) -> None:
        settings = load_settings()
        self.client = ExchangeRestClient()
        self.auth = ExchangeAuth(
            api_key=settings.exchange_api_key,
            api_secret=settings.exchange_api_secret,
        )

    def get_account_info(self, show_zero_balance: bool = False) -> dict:
        params = {
            "showZeroBalance": str(show_zero_balance).lower(),
        }
        signed = self.auth.build_signed_params(params)

        return self.client.get_json(
            "/api/v1/account",
            params=signed,
            headers=self.auth.build_headers(),
        )
