from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import (
    ParadiseUserViewSet, CustomRegisterView, PhoneLoginView,
    SendVerifyCodeView, EmailLoginView, UsernameLoginView, MacAddressLoginView,
    GroupViewSet, AffinityRuleViewSet, AffinityLevelViewSet
)

router = DefaultRouter()
router.register('groups', GroupViewSet, basename='group')
router.register('affinity-rules', AffinityRuleViewSet, basename='affinity-rule')
router.register('affinity-levels', AffinityLevelViewSet, basename='affinity-level')
router.register('', ParadiseUserViewSet)

# 用户视图集的登录相关路径
urlpatterns = [
    # 认证相关路径集中管理
    path('auth/', include('userapp.auth_urls')),
    # 注册相关
    path('auth/register/', CustomRegisterView.as_view(), name='register'),
    # 登录相关
    path('auth/phone/login/', PhoneLoginView.as_view(), name='phone_login'),
    path('auth/email/login/', EmailLoginView.as_view(), name='email_login'),
    path('auth/username/login/', UsernameLoginView.as_view(), name='username_login'),
    path('auth/mac/login/', MacAddressLoginView.as_view(), name='mac_login'),
    # 手机验证码
    path('auth/phone/verify/', SendVerifyCodeView.as_view(), name='send_verify_code'),
    # 第三方账号相关
    path('accounts/', include('allauth.urls')),
    # 包含剩余的用户管理接口
    path('', include(router.urls)),
]