from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import (
    CorporateMemberViewSet, 
    CorporateUserViewSet, 
    TransactionViewSet, 
    CreditRequestViewSet, 
    CreditRequestMemberViewSet,
    PaymentViewSet, 
    InstituteViewSet,
    AffiliatedStudentViewSet,
    UnaffiliatedStudentViewSet,
    WaitForInstituteStudentViewSet,
    CreditRequestInstituteViewSet,
    CreditRequestStudentViewSet,
    Main,
    get_user_transactions,
    check_corporate_user_exists,
    run_credit_transfer,
    check_domain_available,
    check_institute_exists,
    open_bill_corporate,
    payment_received_corporate_member,
    open_bill_institute,
    payment_received_institute_member,
    CorporateReg,
    StudentReg,
    InstituteReg,
    AffliliatedStudentReg,
    IM_Tut,
    S_Tut,
    C_Tut,
    C_demo,
    IM_demo,
    S_demo,


)


# Create a router and register the viewsets
router = DefaultRouter()
router.register(r'corporate-members', CorporateMemberViewSet, basename='corporatemembers')
router.register(r'corporate-users', CorporateUserViewSet, basename='corporateusers')
router.register(r'transactions', TransactionViewSet, basename='transaction')
router.register(r'payments', PaymentViewSet, basename='payment')
router.register(r'credit-requests', CreditRequestViewSet, basename='credit-request')
router.register(r'credit-requests-members', CreditRequestMemberViewSet, basename='credit-request-member')
router.register(r'institute', InstituteViewSet, basename='institute')
router.register(r'affiliated-student', AffiliatedStudentViewSet, basename='affiliated-student')
router.register(r'unaffiliated-student', UnaffiliatedStudentViewSet, basename='unaffiliated-student')
router.register(r'waiting-for-institute-student', WaitForInstituteStudentViewSet, basename='waiting-for-institute-student')
router.register(r'credit-requests-institute', CreditRequestInstituteViewSet, basename='credit-request-institute')
router.register(r'credit-requests-student', CreditRequestStudentViewSet, basename='credit-request-student')


# The URL patterns
urlpatterns = [
    path('api/', include((router.urls, 'api'))),
    path('', Main.as_view(), name="main"),
    path('CorporateRegistration', CorporateReg.as_view(), name="CorporateReg"),
    path('InstituteRegistration', InstituteReg.as_view(), name="InstituteReg"),
    path('StudentRegistration', StudentReg.as_view(), name="StudentReg"),
    path('AffliliatedStudentReg', AffliliatedStudentReg.as_view(), name="AffliliatedStudentReg"),

    path('gut/<int:user_id>/', get_user_transactions, name="get-user-transactions"),
    path('check-corporate-user-exists/', check_corporate_user_exists, name='check-corporate-user-exists'),
    path('check_domain_available/', check_domain_available, name='check_domain_available'),
    path('check-institute-exists/', check_institute_exists, name='check-institute-exists'),

    path('cbill/', open_bill_corporate, name='open-bill-corporate'),
    path('payment-received-corporate-member/', payment_received_corporate_member, name='payment-received-corporate-member'),

    path('ibill/', open_bill_institute, name='open-bill-institute'),
    path('payment-received-institute/', payment_received_institute_member, name='payment-received-institute'),
    path("IM_tutorial",IM_Tut,name="IM_tutorial"),
    path("C_tutorial",C_Tut,name="C_tutorial"),
    path("S_tutorial",S_Tut,name="S_tutorial"),
    path("C_demo",C_demo,name="Corporate_demo"),
    path("i_demo",IM_demo,name="IM_demo"),
    path("S_demo",S_demo,name="Student_demo"),
    
    
]

urlpatterns += [
    path('run_credit_transfer/', run_credit_transfer, name='run_credit_transfer'),
]