<?php

use App\Http\Controllers\api\HomeController;
use App\Http\Controllers\api\ArtController;
use App\Http\Controllers\api\AuthController;
use App\Http\Controllers\api\BookController;
use App\Http\Controllers\api\CategoriesController;
use App\Http\Controllers\api\ChapterController;
use App\Http\Controllers\api\FolderController;
use App\Http\Controllers\api\GateController;
use App\Http\Controllers\api\LawController;
use App\Http\Controllers\api\NoteController;
use App\Http\Controllers\api\NotificationController;
use App\Http\Controllers\api\PartController;
use App\Http\Controllers\api\PayController;
use App\Http\Controllers\api\SectionController;
use App\Http\Controllers\api\SubscribePlanController;
use App\Http\Controllers\api\VersionController;
use App\Http\Controllers\api\VolumController;
use App\Http\Controllers\SuggestionController;
use Illuminate\Support\Facades\Route;

Route::prefix('v1')->group(function () {
    Route::post('login', [AuthController::class, 'login']);
    Route::post('verify', [AuthController::class, 'verify']);
    Route::post('version', [VersionController::class, 'index']);
    Route::post('/payment/callback', [SubscribePlanController::class, 'paymentCallback'])->name('payment.callback');

});

Route::prefix('v1')->middleware('auth:sanctum')->group(function () {
    Route::get('home', [HomeController::class, 'index']);
    Route::get('notifications', [NotificationController::class, 'index']);
    Route::get('art', [ArtController::class, 'index']);
    Route::get('categories',[CategoriesController::class, 'index']);
    Route::post('art/search', [ArtController::class, 'search']);
    Route::post('fast-search',[ArtController::class,'fash_search']);
    Route::post('art/note', [NoteController::class, 'create']);
    Route::put('art/note/{id}', [NoteController::class, 'update']);
    Route::delete('art/note/{id}', [NoteController::class, 'destroy']);
    Route::get('art/{id}', [ArtController::class, 'single']);
    Route::get('laws', [LawController::class, 'index']);
    Route::get('book', [BookController::class, 'index']);
    Route::get('volum', [VolumController::class, 'index']);
    Route::get('book_check', [VolumController::class, 'check']);
    Route::get('book_filter', [VolumController::class, 'check_filter']);
    Route::get('list', [VolumController::class, 'check_filter_with_art']);
    Route::get('section', [SectionController::class, 'index']);
    Route::get('gate', [GateController::class, 'index']);
    Route::get('chapter', [ChapterController::class, 'index']);
    Route::get('parts', [PartController::class, 'index']);

    Route::get('section/{section}/like', [SectionController::class, 'like']);
    Route::get('art/{art}/like', [ArtController::class, 'like']);
    Route::get('likes', [ArtController::class, 'likes']);

    Route::get('subscribe-plans', [SubscribePlanController::class, 'index']);
    Route::post('subscribe-plan-user', [SubscribePlanController::class, 'subscribe']);
    Route::post('subscribe-plan-user-new', [SubscribePlanController::class, 'subscribe_new']);
    Route::get('subscribe-plan-current', [SubscribePlanController::class, 'current']);
    Route::post('pay',[PayController::class, 'pay']);

    Route::get('folders',[FolderController::class,'index']);
    Route::post('folders',[FolderController::class,'create']);
    Route::post('assign_folder',[FolderController::class,'assign']);
    Route::get('folders/{id}',[FolderController::class,'folder']);
    Route::delete('folders/{id}',[FolderController::class,'delete_folder']);
    Route::delete('folders/{id}/art/{art_id}',[FolderController::class,'delete_art']);

    Route::post('suggestions',[SuggestionController::class,'index']);
});

