from django.urls import path, register_converter

from oscar.core.loading import get_class, get_classes

compare_products, start_comparison, add_product, remove_product = get_classes(
    "oscar_compare.views",
    ["compare_products", "start_comparison", "add_product", "remove_product"],
)
NumbersAndSlashes = get_class("oscar_compare.converters", "NumbersAndSlashes")

register_converter(NumbersAndSlashes, "numbers_and_slashes")

app_name = "compare"
urlpatterns = [
    path("products/<numbers_and_slashes:products>/", compare_products, name="products"),
    path("products/start-comparison/", start_comparison, name="start_comparison"),
    path("products/add/<int:pk>/", add_product, name="add_product"),
    path("products/remove/<int:pk>/", remove_product, name="remove_product"),
]
