<?php

use Illuminate\Support\Facades\Route;

# Auth Routes
Route::prefix('auth')->group(function () {
    Route::post('login', 'AuthController@login');
    Route::get('user', 'AuthController@me');
    Route::post('logout', 'AuthController@logout');

    Route::get('status', 'AuthController@status');

    Route::post('password/email', 'ForgotPasswordController@sendResetLinkEmail');
    Route::post('password/reset', 'ResetPasswordController@reset');

    //  Not Implemented yet
    // Route::post('refresh', 'AuthController@refresh');
    // Route::post('signup', 'AuthController@signup');

    # SSO
    Route::get('sso', 'AuthController@sso');
    Route::get('ssoData', 'AuthController@get_sso_data');
});

# Admin Routes
Route::prefix('admin')->name('admin.')->group(function () {
    Route::get('users/getList', 'UserController@getList');
    Route::resource('users', 'UserController', ['only' => ['index', 'show', 'store', 'destroy']]);
});

# Notifications
Route::post('notifications/mark-as-read', 'NotificationController@markAsRead');
Route::post('notifications/delete', 'NotificationController@delete');
Route::post('notifications/test', 'NotificationController@test');

Route::get('notifications/test-mail-notifications', 'CourseNotificationController@testCommand');

# Roles
Route::resource('roles', 'RoleController', ['only' => ['index']]);

# Learning
Route::get('learning-products/count', 'LearningProductController@countAll');
Route::get('learning-products/published', 'LearningProductController@getPublished');
Route::post('learning-products/clone', 'LearningProductController@clone');
Route::resource('learning-products', 'LearningProductController', ['only' => ['index', 'show', 'store', 'destroy']]);

Route::resource('accreditations', 'AccreditationController');
Route::resource('learning-products/notifications', 'CourseNotificationController');
Route::resource('versions', 'VersionController');

Route::resource('checklist-categories', 'ChecklistCategoryController');
Route::resource('checklists', 'ChecklistController');

# Filters
Route::get('filters-with-count', 'FilterController@indexWithCount');
Route::resource('filters', 'FilterController');
Route::resource('filter-items', 'FilterItemController');

# Synonyms
Route::resource('synonyms', 'SynonymController');

# Members
Route::get('members/count', 'MemberController@countAll');
Route::get('members/types', 'TypeController@index');
Route::resource('members/addresses', 'AddressController');
Route::resource('members/summaries', 'SummaryController');
Route::resource('members/contacts', 'ContactController');
Route::resource('members/branches', 'BranchController');
Route::post('members/revision', 'MemberController@storeMemberRevision');
Route::resource('members', 'MemberController');
Route::post('members/managementlink/addlink', 'ManagementLinkController@storeManagementLink');
Route::post('members/managementlink/changelink', 'ManagementLinkController@changeManagementLink');
Route::post('members/managementlink/deletelink', 'ManagementLinkController@destroy');
Route::resource('members/contributions', 'ContributionController');

# Testing
// Route::get('test', function () { // });
Route::get('download-csv', 'CsvExportController@downloadCSV');

# Meta
Route::get('ping', 'PingController@index');
