v2.0.0
==================================================

----------------------------------------
Core
----------------------------------------

- **Complete rewrite.**
   Codebase rebuilt from scratch with clean architecture.

- **Removed synchronous client.**
   Maintaining both sync and async versions added architectural complexity and forced an unnecessary choice on users. Asynchronous I/O is the modern standard and remains the only supported path.

- **Global configuration.**
   New ``Config`` class provides centralized defaults for region, pagination, sorting, and more. Settings applied once affect all clients.

- **Replaced httpx with aiohttp.**
   Improved request performance and connection stability.

- **Upgraded Pydantic from v1 to v2.**
   Faster response parsing and better type safety.

- **Refined exception hierarchy.**
   Exceptions are now more granular, consistent, and provide clearer error context.


----------------------------------------
DatabaseLookup
----------------------------------------

**Complete redesign of item ID resolution.**

Previous ``LocalItem`` and ``WebItem`` classes have been removed. The new ``DatabaseLookup`` system synchronizes a local copy of the official game database and provides **fuzzy search by item/achievement/stat names**.

- **Synchronization.**
   Data is fetched from the ``stalcraft-database`` GitHub repository when needed or explicitly requested.

- **Caching.**
   Search indexes and assets (JSON, PNG) are cached in memory with configurable TTL. Subsequent searches are instant (~0.0001s).

- **Multi‑realm support.**
   Full support for both ``ru`` and ``global`` database versions.

- **No external database required.**
   Everything runs in‑memory, zero setup, zero dependencies.


----------------------------------------
Authentication
----------------------------------------

- **Unified OAuthClient.**
   Replaced separate ``AppAuth`` and ``UserAuth`` classes. Single client handles both application and user token flows.

- **Configurable OAuth endpoint.**
   ``base_url`` parameter allows switching between ``.net`` and ``.ru`` domains.

- **CSRF protection.**
   ``get_authorize_url()`` now accepts an optional ``state`` parameter. The old ``code_url`` attribute is removed.


----------------------------------------
Documentation
----------------------------------------

- **Added complete documentation.**
   Includes ``Guides`` (concepts) and ``API Reference`` (autogenerated).


----------------------------------------
Migration Guide (v1.x → v2.0)
----------------------------------------

- **Renamed package name.**
   ``stalcraft`` → ``scapi``. Shorter, import friendly, no ambiguity with game name.


.. list-table:: Replaced with new implementation
   :header-rows: 1
   :widths: 40 60

   * - v1.x
     - v2.0
   * - ``stalcraft.api``
     - ``scapi.http``
   * - ``stalcraft.items``
     - ``scapi.database``


.. list-table:: Moved with preserved logic
   :header-rows: 1
   :widths: 40 60

   * - v1.x
     - v2.0
   * - ``stalcraft.auth``
     - ``scapi.oauth``
   * - ``stalcraft.auction``
     - ``scapi.client.auction.shared``
   * - ``stalcraft.clan.clan``
     - ``scapi.client.clan.shared``
   * - ``stalcraft.clan.user``
     - ``scapi.client.clan.user``
   * - ``stalcraft.utils.listing``
     - ``scapi.http.types``
   * - ``stalcraft.schemas``
     - ``client.models``, ``oauth.models``, ``http.ratelimit``


.. list-table:: Renamed enums
   :header-rows: 1
   :widths: 40 60

   * - Old
     - New
   * - ``Sort``
     - ``SortAuction``
   * - ``OperationSort``
     - ``SortOperations``
   * - ``ItemsFolder``
     - ``Realm``


.. list-table:: Removed constants
   :header-rows: 1
   :widths: 40 60

   * - Constant
     - Replacement
   * - ``AuthUrl``
     - ``BaseUrl.OAUTH``
   * - ``StatusCode``
     - Exceptions types