from django.urls import path
from django.contrib.auth import views as auth_views
from django.conf import settings
from django.conf.urls.static import static

from . import views
from .views import register_manual_vacation, intern_dashboard

urlpatterns = [
    # Autenticação
    path('login/', views.login_view, name='login'),
    path('logout/', views.logout_view, name='logout'),
    path('', views.home, name='home'),
    path('dashboard/', views.dashboard, name='dashboard'),

    # Employee
    path('employee/dashboard/', views.employee_dashboard, name='employee_dashboard'),
    path('employee/request/', views.request_vacation, name='request_vacation'),
    path('employee/history/', views.view_history, name='view_history'),
    path('employee/activate/<int:user_id>/', views.activate_employee, name='activate_employee'),
    path('employee/deactivate/<int:user_id>/', views.deactivate_employee, name='deactivate_employee'),

    # Manager
    path('manager/dashboard/', views.manager_dashboard, name='manager_dashboard'),
    path('manager/pending/', views.pending_requests, name='manager_pending_requests'),
    path('manager/calendar/', views.team_calendar, name='team_calendar'),

    # RH (Admin)
    path('hr/dashboard/', views.admin_dashboard, name='admin_dashboard'),
    path('hr/pending/', views.pending_requests, name='pending_requests'),  # Ex: lista geral ou duplicado? pode remover se necessário
    path('hr/review/<uuid:vacation_id>/', views.review_request, name='review_request'),
    path('hr/employees/', views.manage_employees, name='manage_employees'),
    path('hr/employees/edit/<uuid:employee_id>/', views.edit_employee, name='edit_employee'),
    path('employees/delete/<uuid:employee_id>/', views.delete_employee, name='delete_employee'),
    path('hr/companies/', views.manage_companies, name='manage_companies'),
    path('hr/companies/edit/<uuid:company_id>/', views.edit_company, name='edit_company'),
    path('hr/cost-centers/', views.manage_cost_centers, name='manage_cost_centers'),
    path('hr/cost-centers/edit/<uuid:cost_center_id>/', views.edit_cost_center, name='edit_cost_center'),
    path('hr/cost-centers/delete/<uuid:cost_center_id>/', views.delete_cost_center, name='delete_cost_center'),
    path('hr/reports/', views.reports, name='reports'),

    # Estágio
    path('estagiario/', intern_dashboard, name='intern_dashboard'),
    path('estagio/aprovar/', views.approve_intern_report, name='approve_intern_report'),
    path('estagiario/exportar/', views.export_clock_records, name='export_clock_records'),

    # Férias manuais
    path('ferias/registrar/', register_manual_vacation, name='register_manual_vacation'),

    # Relatório PDF
    path('relatorio/pdf/<uuid:intern_id>/<int:year>/<int:month>/', views.gerar_espelho_ponto_pdf, name='gerar_espelho_ponto_pdf'),

    # API
    path('api/cost-centers/', views.get_cost_centers_json, name='get_cost_centers_json'),

    # Redefinição de senha
    path('password-reset/', auth_views.PasswordResetView.as_view(), name='password_reset'),
    path('password-reset/done/', auth_views.PasswordResetDoneView.as_view(), name='password_reset_done'),
    path('reset/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'),
    path('reset/done/', auth_views.PasswordResetCompleteView.as_view(), name='password_reset_complete'),
    path('manager/review/<uuid:vacation_id>/', views.manager_review_request, name='review_request'),
    path('hr/requests/pending/', views.all_pending_requests, name='all_pending_requests'),
    path('hr/approved-vacations/', views.approved_vacations_list, name='approved_vacations_list'),
    path('employee/cancel/<uuid:vacation_id>/', views.cancelar_ferias, name='cancelar_ferias'),
    path('employee/cancel/<uuid:vacation_id>/', views.cancelar_ferias, name='cancelar_ferias'),


]

# Serve arquivos de mídia no modo de desenvolvimento
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
