"""garantipay -- Python client for the Garanti BBVA Virtual POS (GVP) API.

A modern, fully-typed Python library for integrating with the Garanti BBVA
Virtual POS payment gateway. Supports sales, refunds, voids, 3D Secure
transactions, **card tokenization**, and **recurring/subscription payments**.

Quick Start -- One-Time Payments
--------------------------------

**High-level API** (recommended)::

    from garantipay import GarantiClient

    client = GarantiClient(
        terminal_id="12345678",
        merchant_id="1234567",
        prov_user_id="PROVAUT",
        user_id="99999999999",
        password="123qweASD*",
        mode="TEST",
    )

    response = client.sale(
        card_number="1234567890123456",
        card_expire_date="0326",
        card_cvv2="123",
        amount="100",
        customer_ip="1.2.3.4",
    )

    if response.is_successful:
        print("Payment approved!")

Quick Start -- Recurring Payments (Switch API)
----------------------------------------------

::

    from garantipay import SwitchClient

    switch = SwitchClient(
        swt_id="YOUR_SWITCH_ID",
        swt_password="YOUR_SWITCH_PASSWORD",
        user_id="my_system",
        mode="TEST",
    )

    # Store card and get a token (first time only)
    token_resp = switch.generate_token(
        card_number="5549601634451019",
        expire_month="02",
        expire_year="25",
    )
    token = token_resp.card.token  # Save in your database

    # Charge monthly using the token (no card details needed)
    payment = switch.sale_with_token(
        token=token,
        amount="29.90",
        customer_ip="192.168.1.1",
    )
"""

__version__ = "1.1.0"

from garantipay.client import API, GarantiClient
from garantipay.constants import CURRENCIES, ENDPOINTS
from garantipay.exceptions import (
    GarantiPayAPIError,
    GarantiPayConnectionError,
    GarantiPayError,
    GarantiPayValidationError,
    GarantiPayXMLError,
)
from garantipay.hash import compute_hash_data, compute_password_hash, sha1
from garantipay.models import (
    Address,
    AddressList,
    Card,
    Customer,
    Order,
    Request,
    Response,
    ResponseTransaction,
    RewardInqResult,
    Secure3D,
    Terminal,
    Transaction,
    TransactionResponse,
)
from garantipay.switch_client import SwitchClient
from garantipay.switch_constants import SWITCH_ENDPOINTS
from garantipay.switch_hash import (
    compute_switch_request_hash,
    sha256,
    verify_switch_response_hash,
)
from garantipay.switch_models import (
    SwitchAcquirer,
    SwitchAcquirerResponse,
    SwitchCard,
    SwitchCardHolder,
    SwitchCardResponse,
    SwitchHeader,
    SwitchPaymentResponse,
    SwitchResponse,
    SwitchResponseHeader,
    SwitchTokenResponse,
)
from garantipay.xml_parser import response_to_pretty_xml

__all__ = [
    # Version
    "__version__",
    # VPServlet clients (one-time payments)
    "GarantiClient",
    "API",
    # Switch client (tokenization & recurring payments)
    "SwitchClient",
    # VPServlet request models
    "Request",
    "Terminal",
    "Card",
    "Customer",
    "Order",
    "AddressList",
    "Address",
    "Transaction",
    "Secure3D",
    # VPServlet response models
    "Response",
    "TransactionResponse",
    "ResponseTransaction",
    "RewardInqResult",
    # Switch request models
    "SwitchHeader",
    "SwitchCard",
    "SwitchCardHolder",
    "SwitchAcquirer",
    # Switch response models
    "SwitchResponse",
    "SwitchTokenResponse",
    "SwitchPaymentResponse",
    "SwitchResponseHeader",
    "SwitchCardResponse",
    "SwitchAcquirerResponse",
    # Constants
    "CURRENCIES",
    "ENDPOINTS",
    "SWITCH_ENDPOINTS",
    # VPServlet hash utilities
    "sha1",
    "compute_hash_data",
    "compute_password_hash",
    # Switch hash utilities
    "sha256",
    "compute_switch_request_hash",
    "verify_switch_response_hash",
    # XML utilities
    "response_to_pretty_xml",
    # Exceptions
    "GarantiPayError",
    "GarantiPayConnectionError",
    "GarantiPayAPIError",
    "GarantiPayValidationError",
    "GarantiPayXMLError",
]
