from __future__ import annotations

from ebay_client.account.client import AccountClient
from ebay_client.core.auth.oauth import EbayOAuthClient, EbayOAuthConfig
from ebay_client.core.auth.store import InMemoryTokenStore, TokenStore
from ebay_client.core.http.transport import ApiTransport
from ebay_client.feed.client import FeedClient
from ebay_client.fulfillment.client import FulfillmentClient
from ebay_client.inventory.client import InventoryClient
from ebay_client.notification.client import NotificationClient


class EbayClient:
    def __init__(
        self,
        oauth_config: EbayOAuthConfig,
        *,
        token_store: TokenStore | None = None,
        base_url: str = "https://api.ebay.com",
        timeout_seconds: float = 30.0,
    ) -> None:
        store = token_store or InMemoryTokenStore()
        oauth_client = EbayOAuthClient(oauth_config, token_store=store)
        transport = ApiTransport(
            base_url=base_url,
            oauth_client=oauth_client,
            timeout_seconds=timeout_seconds,
        )
        self.notification = NotificationClient(transport)
        self.inventory = InventoryClient(transport)
        self.fulfillment = FulfillmentClient(transport)
        self.account = AccountClient(transport)
        self.feed = FeedClient(transport)
