from django.urls import path
from . import views_frontend
from . import views
from . import views_integration

urlpatterns = [
    path('dashboard/', views_frontend.dashboard_view, name='dashboard'),

    # Job URLs (using JobPosting model)
    path('jobs/', views_frontend.JobListView.as_view(), name='job_list'),
    path('jobs/create/', views.create_job, name='job_create'),
    path('job/<slug:slug>/upload_image_simple/', views.job_image_upload, name='job_image_upload'), 
    path('jobs/<slug:slug>/update/', views.edit_job, name='job_update'),
    # path('jobs/<slug:slug>/delete/', views., name='job_delete'),
    path('jobs/<slug:slug>/', views.job_detail, name='job_detail'),
    path('jobs/<slug:slug>/candidate/', views.job_detail_candidate, name='job_detail_candidate'),
    path('jobs/<slug:slug>/candidate/application/success', views.application_success, name='application_success'),


    # LinkedIn Integration URLs
    path('jobs/<slug:slug>/post-to-linkedin/', views.post_to_linkedin, name='post_to_linkedin'),
    path('jobs/linkedin/login/', views.linkedin_login, name='linkedin_login'),
    path('jobs/linkedin/callback/', views.linkedin_callback, name='linkedin_callback'),

    path('jobs/<slug:slug>/schedule-interviews/', views.schedule_interviews_view, name='schedule_interviews'),
    # Candidate URLs
    path('candidates/', views_frontend.CandidateListView.as_view(), name='candidate_list'),
    path('candidates/create/', views_frontend.CandidateCreateView.as_view(), name='candidate_create'),
    path('candidates/create/<slug:slug>/', views_frontend.CandidateCreateView.as_view(), name='candidate_create_for_job'),
    path('jobs/<slug:slug>/candidates/', views_frontend.JobCandidatesListView.as_view(), name='job_candidates_list'),
    path('candidates/<slug:slug>/update/', views_frontend.CandidateUpdateView.as_view(), name='candidate_update'),
    path('candidates/<slug:slug>/delete/', views_frontend.CandidateDeleteView.as_view(), name='candidate_delete'),
    path('candidate/<slug:slug>/view/', views_frontend.candidate_detail, name='candidate_detail'),
    path('candidate/<slug:slug>/update-stage/', views_frontend.candidate_update_stage, name='candidate_update_stage'),
   

    # Training URLs
    path('training/', views_frontend.TrainingListView.as_view(), name='training_list'),
    path('training/create/', views_frontend.TrainingCreateView.as_view(), name='training_create'),
    path('training/<slug:slug>/', views_frontend.TrainingDetailView.as_view(), name='training_detail'),
    path('training/<slug:slug>/update/', views_frontend.TrainingUpdateView.as_view(), name='training_update'),
    path('training/<slug:slug>/delete/', views_frontend.TrainingDeleteView.as_view(), name='training_delete'),

    # Meeting URLs
    path('', views.ZoomMeetingListView.as_view(), name='list_meetings'),
    path('create-meeting/', views.ZoomMeetingCreateView.as_view(), name='create_meeting'),
    path('meeting-details/<slug:slug>/', views.ZoomMeetingDetailsView.as_view(), name='meeting_details'),
    path('update-meeting/<slug:slug>/', views.ZoomMeetingUpdateView.as_view(), name='update_meeting'),
    path('delete-meeting/<slug:slug>/', views.ZoomMeetingDeleteView, name='delete_meeting'),

    # JobPosting functional views URLs (keeping for compatibility)
    path('api/create/', views.create_job, name='create_job_api'),
    path('api/<slug:slug>/edit/', views.edit_job, name='edit_job_api'),

    # ERP Integration URLs
    path('integration/erp/', views_integration.ERPIntegrationView.as_view(), name='erp_integration'),
    path('integration/erp/create-job/', views_integration.erp_create_job_view, name='erp_create_job'),
    path('integration/erp/update-job/', views_integration.erp_update_job_view, name='erp_update_job'),
    path('integration/erp/health/', views_integration.erp_integration_health, name='erp_integration_health'),

    # Form Preview URLs
    # path('forms/', views.form_list, name='form_list'),
    path('forms/builder/', views.form_builder, name='form_builder'),
    path('forms/builder/<int:template_id>/', views.form_builder, name='form_builder'),
    path('forms/', views.form_templates_list, name='form_templates_list'),
    path('forms/create-template/', views.create_form_template, name='create_form_template'),

    # path('forms/form/<int:template_id>/submit/', views.submit_form, name='submit_form'),
    # path('forms/form/<int:template_id>/', views.form_wizard_view, name='form_wizard'),
    path('forms/<int:form_id>/submissions/<int:submission_id>/', views.form_submission_details, name='form_submission_details'),
    path('forms/template/<slug:slug>/submissions/', views.form_template_submissions_list, name='form_template_submissions_list'),

    # path('forms/<int:form_id>/', views.form_preview, name='form_preview'),
    # path('forms/<int:form_id>/submit/', views.form_submit, name='form_submit'),
    # path('forms/<int:form_id>/embed/', views.form_embed, name='form_embed'),
    # path('forms/<int:form_id>/submissions/', views.form_submissions, name='form_submissions'),
    # path('forms/<int:form_id>/edit/', views.edit_form, name='edit_form'),
    # path('api/forms/save/', views.save_form_builder, name='save_form_builder'),
    # path('api/forms/<int:form_id>/load/', views.load_form, name='load_form'),
    # path('api/forms/<int:form_id>/update/', views.update_form_builder, name='update_form_builder'),

]
