from django.urls import path, include
from rest_framework import routers
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns


from app.applicationlayer.cms.form import views as crform_views
from app.applicationlayer.cms.allowed_company import views as allowed

# MASTERS Form
from app.applicationlayer.cms.master.template.company.views import ChangeRequestCompanyTemplateViewSet
from app.applicationlayer.cms.master.template.department.views import  ChangeRequestDepartmentTemplateViewSet
from app.applicationlayer.cms.master.template.account.views import  UserListTemplate
from app.applicationlayer.cms.master.template_list.views import  ChangeRequestTemplateHeaderMaster
from app.applicationlayer.cms.master.template.default_approver.views import DefaultApproverViewSet
# MASTERS Form


# MASTERS Template
from app.applicationlayer.cms.master.form.company.views import ChangeRequestCompanyFormViewSet
from app.applicationlayer.cms.master.form.department.views import  ChangeRequestDepartmentFormViewSet
from app.applicationlayer.cms.master.form.account.views import  UserListForm
# MASTERS Template

# TEMPLATE 
from app.applicationlayer.cms.template.header import views as header
from app.applicationlayer.cms.template.approver import views as approver
from app.applicationlayer.cms.template.stakeholder import views as stakeholder
from app.applicationlayer.cms.template.details import views as details
from app.applicationlayer.cms.template.attachment import views as attachment
# TEMPLATE 


# FORM
from app.applicationlayer.cms.form.header import views as headerform
from app.applicationlayer.cms.form.approver import views as approverform
from app.applicationlayer.cms.form.stakeholder import views as stakeholderform
from app.applicationlayer.cms.form.details import views as detailsform
from app.applicationlayer.cms.form.attachment import views as attachmentform
# FORM


# AUTO_EMAIL
from app.applicationlayer.cms.auto_email import reminder, overdue, cancel
# AUTO_EMAIL

from app.applicationlayer.cms.form.download import views as dl

router = routers.DefaultRouter()

router.register(r'template', header.ChangeRequestTemplatesViewset)
router.register(r'template-approvers', approver.ChangeRequestTemplateApproversViewset)
router.register(r'template-attachments', attachment.ChangeRequestTemplateAttachmentsViewset)
router.register(r'template-stakeholders', stakeholder.ChangeRequestTemplateStakeholdersViewset)
router.register(r'template-details', details.ChangeRequestTemplateDetailsViewset)

router.register(r'form', headerform.ChangeRequestFormsViewset)
router.register(r'form-approvers', approverform.ChangeRequestFormApproversViewset)
router.register(r'form-stakeholders', stakeholderform.ChangeRequestFormStakeHoldersViewset)
router.register(r'form-attachments', attachmentform.ChangeRequestFormAttachmentsViewset)
router.register(r'form-details', detailsform.ChangeRequestFormDetailsViewset)

router.register(r'form-download', dl.DownloadRequest)

# privilege CMS
router.register(r'allowed-companies', allowed.AllowedCompanyViewSet)
# privilege CMS

# filter endpoints under Allowed Companies table
router.register(r'template-companies', ChangeRequestCompanyTemplateViewSet)
router.register(r'template-departments', ChangeRequestDepartmentTemplateViewSet)
router.register(r'allowed-templates', ChangeRequestTemplateHeaderMaster)
router.register(r'default-approvers', DefaultApproverViewSet)
# filter endpoints under Allowed Companies table

# filter endpoints under Allowed Companies table
router.register(r'form-companies', ChangeRequestCompanyFormViewSet)
router.register(r'form-departments', ChangeRequestDepartmentFormViewSet)
# filter endpoints under Allowed Companies table

urlpatterns = [
    path('', include(router.urls)),
    path('template-post/', header.ChangeRequestTemplatePost.as_view()),
    path('form-post/', headerform.ChangeRequestFormPost.as_view()),
    # filter endpoints under Allowed Companies table
    # path('template-user-list/', UserList.as_view(), name="User TemplateList"),
    path('form-user-list/', UserListForm.as_view(), name="User List"),
    path('template-user-list/', UserListTemplate.as_view(), name="User List"),
    # filter endpoints under Allowed Companies table
    path('reminder/', reminder.ReminderTriggerAPIView.as_view()),
    path('cancelled/', cancel.CancelTriggerAPIView.as_view()),
    path('overdue/', overdue.OverdueTriggerAPIView.as_view()),
]

# urlpatterns += format_suffix_patterns(urlpatterns)
# urlpatterns += router.urls
