from __future__ import annotations

from decimal import Decimal

from src.ctb_copy.models import CopyCostInput
from src.ctb_copy.shadow.follower_fill_model import estimate_follower_net_pnl


def test_follower_net_pnl_subtracts_all_copy_costs() -> None:
    result = estimate_follower_net_pnl(
        CopyCostInput(
            notional_usd=Decimal("1000"),
            gross_pnl_usd=Decimal("25"),
            entry_fee_pct=Decimal("0.045"),
            exit_fee_pct=Decimal("0.045"),
            spread_pct=Decimal("0.02"),
            modeled_slippage_pct=Decimal("0.05"),
            funding_usd=Decimal("1.25"),
            delay_penalty_usd=Decimal("2.00"),
        )
    )

    assert result.entry_fee_usd == Decimal("0.45000")
    assert result.exit_fee_usd == Decimal("0.45000")
    assert result.spread_cost_usd == Decimal("0.2000")
    assert result.modeled_slippage_usd == Decimal("0.5000")
    assert result.net_pnl_usd == Decimal("20.15000")
