"""Convenience re-exports for :mod:`fuggers_py.rates`.

The root rates namespace exposes the commonly used trade objects, pricing
facades, risk helpers, and futures utilities. Unless stated otherwise, quoted
rates and spreads are raw decimals and quoted bond prices are percent of par.
"""

from __future__ import annotations

from typing import TYPE_CHECKING

from fuggers_py.data import (
    BasisSwapQuote,
    BasisSwapQuoteOutput,
    BondFutureContractReference,
    BondFutureQuote,
    BondFutureReferenceData,
    DeliverableBondReference,
    FutureQuoteOutput,
    FutureReferenceData,
    SwapQuote,
    SwapQuoteOutput,
    SwapReferenceData,
)
from .futures import (
    CheapestToDeliverResult,
    ConversionFactorResult,
    DeliverableBasket,
    DeliverableBond,
    DeliverableCandidate,
    DeliveryOptionModel,
    DeliveryOptionResult,
    DeliveryOptionScenario,
    FairFuturesPriceResult,
    FuturesBasis,
    GovernmentBondFuture,
    InvoiceBreakdown,
    MultiFactorDeliveryOptionModel,
    MultiFactorScenario,
    NoDeliveryOptionModel,
    OneFactorDeliveryOptionModel,
    YieldGridCTDSwitchModel,
    basis_metrics,
    cheapest_to_deliver,
    conversion_factor,
    delivery_payoff,
    fair_futures_price,
    gross_basis,
    invoice_amount,
    invoice_breakdown,
    invoice_clean_price,
    invoice_price,
    net_basis,
    oabpv,
    theoretical_conversion_factor,
)
from .instruments import (
    AssetSwap,
    BasisSwap,
    CrossCurrencyBasisSwap,
    FixedFloatSwap,
    FixedLegSpec,
    FloatingLegSpec,
    ForwardRateAgreement,
    Fra,
    InterestRateSwap,
    Ois,
    OvernightIndexedSwap,
    PayReceive,
    SameCurrencyBasisSwap,
    ScheduleDefinition,
)
from .options import (
    BachelierPricer,
    Black76Pricer,
    CapFloor,
    CapFloorPricingResult,
    CapFloorType,
    CapFloorletPricingResult,
    FuturesOption,
    FuturesOptionPricingResult,
    HullWhiteOptionPricer,
    HullWhiteRateOptionModel,
    OptionFormulaResult,
    OptionGreeks,
    OptionType,
    Swaption,
    SwaptionPricingResult,
    bachelier_formula,
    black76_formula,
    hull_white_normal_volatility,
)
from .pricing import (
    BasisSwapPricer,
    BasisSwapPricingResult,
    CrossCurrencyBasisSwapPricer,
    CrossCurrencyBasisSwapPricingResult,
    FraPricer,
    FraPricingResult,
    SwapPricer,
    SwapPricingResult,
)
from .risk import (
    basis_swap_key_rate_risk,
    basis_swap_pv01,
    bpv,
    fra_key_rate_risk,
    fra_pv01,
    key_rate_risk,
    pv01,
    swap_key_rate_risk,
    swap_pv01,
)

if TYPE_CHECKING:
    from .pricing import AssetSwapBreakdown, AssetSwapPricer, AssetSwapPricingResult


def __getattr__(name: str) -> object:
    if name in {"AssetSwapBreakdown", "AssetSwapPricer", "AssetSwapPricingResult"}:
        from .pricing import AssetSwapBreakdown, AssetSwapPricer, AssetSwapPricingResult

        return {
            "AssetSwapBreakdown": AssetSwapBreakdown,
            "AssetSwapPricer": AssetSwapPricer,
            "AssetSwapPricingResult": AssetSwapPricingResult,
        }[name]
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

__all__ = [
    "AssetSwap",
    "AssetSwapBreakdown",
    "AssetSwapPricer",
    "AssetSwapPricingResult",
    "BasisSwap",
    "BasisSwapQuote",
    "BasisSwapQuoteOutput",
    "BasisSwapPricer",
    "BasisSwapPricingResult",
    "BachelierPricer",
    "Black76Pricer",
    "CrossCurrencyBasisSwap",
    "CrossCurrencyBasisSwapPricer",
    "CrossCurrencyBasisSwapPricingResult",
    "BondFutureContractReference",
    "BondFutureQuote",
    "BondFutureReferenceData",
    "bpv",
    "CapFloor",
    "CapFloorPricingResult",
    "CapFloorType",
    "CapFloorletPricingResult",
    "bachelier_formula",
    "basis_swap_key_rate_risk",
    "basis_swap_pv01",
    "basis_metrics",
    "CheapestToDeliverResult",
    "ConversionFactorResult",
    "cheapest_to_deliver",
    "conversion_factor",
    "DeliverableBasket",
    "DeliverableBond",
    "DeliverableBondReference",
    "DeliverableCandidate",
    "delivery_payoff",
    "DeliveryOptionModel",
    "DeliveryOptionResult",
    "DeliveryOptionScenario",
    "FairFuturesPriceResult",
    "FixedFloatSwap",
    "FixedLegSpec",
    "FloatingLegSpec",
    "ForwardRateAgreement",
    "Fra",
    "FraPricer",
    "FraPricingResult",
    "fra_key_rate_risk",
    "fra_pv01",
    "FutureQuoteOutput",
    "FutureReferenceData",
    "FuturesOption",
    "FuturesOptionPricingResult",
    "FuturesBasis",
    "GovernmentBondFuture",
    "gross_basis",
    "HullWhiteOptionPricer",
    "HullWhiteRateOptionModel",
    "hull_white_normal_volatility",
    "InvoiceBreakdown",
    "invoice_amount",
    "invoice_breakdown",
    "invoice_clean_price",
    "invoice_price",
    "InterestRateSwap",
    "key_rate_risk",
    "MultiFactorDeliveryOptionModel",
    "MultiFactorScenario",
    "net_basis",
    "NoDeliveryOptionModel",
    "OneFactorDeliveryOptionModel",
    "Ois",
    "OptionFormulaResult",
    "OptionGreeks",
    "OptionType",
    "OvernightIndexedSwap",
    "oabpv",
    "PayReceive",
    "pv01",
    "SameCurrencyBasisSwap",
    "ScheduleDefinition",
    "Swaption",
    "SwaptionPricingResult",
    "SwapQuote",
    "SwapQuoteOutput",
    "SwapPricer",
    "SwapPricingResult",
    "SwapReferenceData",
    "black76_formula",
    "swap_key_rate_risk",
    "swap_pv01",
    "theoretical_conversion_factor",
    "YieldGridCTDSwitchModel",
    "fair_futures_price",
]
