from app_new.core.setup_catalog import LOT_TASKS


def test_embedded_preventive_catalog_has_historical_shape():
    """Garde-fou du catalogue extrait du dump de référence."""
    assert len(LOT_TASKS) == 330
    assert all(item['lot'] and item['tache'] for item in LOT_TASKS)
    assert all(item['type_maintenance'] in ('préventive', 'preventive', 'curative', None) for item in LOT_TASKS)
    assert sum(item['duree_minutes'] is not None for item in LOT_TASKS) == 5
    assert sum(bool(item['periodicite']) for item in LOT_TASKS) == 327
    assert len({(item['lot'], item['num_tache']) for item in LOT_TASKS}) == len(LOT_TASKS)


def test_catalog_tasks_have_stable_functional_keys():
    keys = [(item['lot'].casefold(), item['tache'].casefold()) for item in LOT_TASKS]
    assert len(keys) == len(set(keys))
