"""Tests for plan definitions."""

from __future__ import annotations

import pytest

from llmhosts.plans import PLANS, get_plan_limits


@pytest.mark.unit
def test_free_plan_defaults() -> None:
    p = get_plan_limits("free")
    assert p.rpm == 60
    assert p.devices == 1
    assert not p.tunnel_public


@pytest.mark.unit
def test_pro_plan() -> None:
    p = get_plan_limits("pro")
    assert p.rpm == 300
    assert p.devices == 5
    assert p.tunnel_public


@pytest.mark.unit
def test_team_plan() -> None:
    p = get_plan_limits("team")
    assert p.rpm == 600
    assert p.devices == 25
    assert p.hive_mode
    assert p.rbac


@pytest.mark.unit
def test_enterprise_plan() -> None:
    p = get_plan_limits("enterprise")
    assert p.rpm == 0  # unlimited
    assert p.devices == 0  # unlimited
    assert p.tunnel_public
    assert p.hive_mode


@pytest.mark.unit
def test_unknown_plan_falls_back_to_free() -> None:
    p = get_plan_limits("nonexistent")
    assert p.rpm == 60


@pytest.mark.unit
def test_all_plans_exist() -> None:
    assert set(PLANS.keys()) == {"free", "pro", "team", "enterprise"}
