"""insurance-copula: vine copulas for multi-peril home insurance pricing.

Wraps pyvinecopulib with an insurance-specific workflow:
exposure-weighted fitting, marginal back-transformation, conditional
expectation estimation, and aggregate loss simulation.

Primary use case: UK home insurance portfolios where perils (flood,
subsidence, storm, escape of water, fire, theft) are priced
independently but exhibit meaningful loss correlations that distort
portfolio-level risk estimates.

Basic usage::

    from insurance_copula import PerilVine
    from scipy.stats import gamma

    vine = PerilVine(perils=['flood', 'storm', 'eow', 'subsidence'])
    vine.fit(losses_df, exposure=earned_exposure_series)

    samples = vine.simulate(10_000, marginals={
        'flood':      gamma(a=0.8, scale=5_000),
        'storm':      gamma(a=1.2, scale=800),
        'eow':        gamma(a=1.5, scale=600),
        'subsidence': gamma(a=0.6, scale=3_000),
    })

    result = vine.aggregate_loss(
        n_sim=10_000,
        marginals={...},
        n_policies=50_000,
        seed=42,
    )
    print(f"PML 1-in-200: {result.pml_1_in_200:,.0f}")
"""

from ._vine import PerilVine, HAS_PYVINECOPULIB
from ._results import AggregateResult, PerilVineDiagnostics

__all__ = [
    "PerilVine",
    "AggregateResult",
    "PerilVineDiagnostics",
    "HAS_PYVINECOPULIB",
]

try:
    from importlib.metadata import version, PackageNotFoundError
    try:
        __version__ = version("insurance-copula")
    except PackageNotFoundError:
        __version__ = "dev"
except Exception:
    __version__ = "dev"
