from django.urls import path
from . import views

urlpatterns = [
    path('', views.home, name='home'),
    path('attendance/', views.attendance_page, name='attendance_page'),
    path('my-record/', views.my_record_view, name='my_record'),
    path('students/', views.students_index, name='students_index'),
    path('students/<int:pk>/', views.student_detail, name='student_detail'),
    path('points/', views.points_page, name='points_page'),
    path('escalation/', views.escalation_page, name='escalation_page'),
    path('policies/public/', views.policies_public, name='policies_public'),
    path('policies/', views.policies_page, name='policies_page'),
    path('convert/', views.convert_page, name='convert_page'),
    path('daily/', views.daily_page, name='daily_page'),
    path('award/', views.award, name='award'),
    path('deduct/', views.deduct, name='deduct'),
    path('escalate/', views.escalate, name='escalate'),
    path('convert-apply/', views.convert_apply, name='convert_apply'),
    path('sessions/', views.sessions_index, name='sessions_index'),
    path('sessions/<int:pk>/kill/', views.session_kill, name='session_kill'),
    path('sessions/kill-all/', views.session_kill_all, name='session_kill_all'),
    path('owner/', views.owner_home, name='owner_home'),
    path('violations/', views.violations_index, name='violations_index'),
        path('class-homework/', views.class_homework_page, name='class_homework'),
    path('class-homework/bulk-diary/', views.class_homework_bulk_diary, name='class_homework_bulk_diary'),
    path('class-homework/bulk/', views.teacher_handwriting_bulk_assign, name='class_homework_bulk'),
]

# pass-2 auto-wire 20261018_164505
_wire_discipline=[
    path('attendance-save/', views.attendance_save, name='attendance_save'),
    path('attendance-unlock/', views.attendance_unlock, name='attendance_unlock'),
    path('class-homework/', views.class_homework_page, name='class_homework_page'),
    path('class-homework/save/', views.class_homework_save, name='class_homework_save'),
        path('fee-toggle/', views.fee_toggle, name='fee_toggle'),
    path('fee-unlock-session/', views.fee_unlock_session, name='fee_unlock_session'),
    path('fees-init/', views.fees_init, name='fees_init'),
    path('fees/', views.fees_page, name='fees_page'),
    path('fees-unlock/', views.fees_unlock, name='fees_unlock'),
    path('owner/change-fees-pw/', views.owner_change_fees_pw, name='owner_change_fees_pw'),
    path('owner/change-pin/', views.owner_change_pin, name='owner_change_pin'),
    path('owner/toggle-pin-required/', views.owner_toggle_pin_required, name='owner_toggle_pin_required'),
]
urlpatterns += _wire_discipline

# Fixed by G5a (Signature mismatches)
urlpatterns += [
    path('class-homework/diary/<int:pk>/', views.class_homework_diary, name='class_homework_diary'),
    path('my-diary/', views.my_diary, name='my_diary'),
        path('violations/action/<int:pk>/', views.violation_action, name='violation_action'),
]

# Engine API Routes
from exams import views as engine_views
urlpatterns += [
    path('api/engine/status/', engine_views.engine_status, name='engine_status'),
    path('api/engine/toggle/', engine_views.engine_toggle, name='engine_toggle'),
]


# ─── Delegation URLs (fixed 2026-11-12) ───
# These were missing while discipline/views.py already redirects to
# discipline:delegations_home in 12 places, causing 404s.
urlpatterns += [
    path('delegations/', views.delegations_home, name='delegations_home'),
    path('delegations/create/', views.delegation_create, name='delegation_create'),
    path('delegations/revoke/<int:pk>/', views.delegation_revoke, name='delegation_revoke'),
]
