<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\TagController;
use App\Http\Controllers\FeedsController;
use App\Http\Controllers\MoneyController;
use App\Http\Controllers\UsersController;
use App\Http\Controllers\ImagesController;
use App\Http\Controllers\MusicsController;
use App\Http\Controllers\StaticController;
use App\Http\Controllers\VideosController;
use App\Http\Controllers\CommentController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\SettingController;
use App\Http\Controllers\PurchaseController;
use App\Http\Controllers\ComplaintController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\MessengerController;
use App\Http\Controllers\RequisitesController;
use App\Http\Controllers\UserPackageController;
use App\Http\Controllers\Auth\NewPasswordController;
use App\Http\Controllers\Auth\VerifyEmailController;
use App\Http\Controllers\Auth\RegisteredUserController;
use App\Http\Controllers\Auth\PasswordResetLinkController;
use App\Http\Controllers\Auth\AuthenticatedSessionController;
use App\Http\Controllers\Auth\EmailVerificationPromptController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/tttttt', [UsersController::class, 'testing']);


Route::get('/', [DashboardController::class, 'index'])
    ->name('dashboard');

// Images

Route::put('user-banner', [StaticController::class, 'banner'])
    ->name('image.banner')
    ->middleware('auth');
Route::put('user-avatar', [StaticController::class, 'avatar'])
    ->name('image.avatar')
    ->middleware('auth');
Route::delete('feed-preview-remove/{id}', [StaticController::class, 'removePreview'])
    ->name('feed.preview.destroy')
    ->middleware('auth');
Route::delete('user-banner', [StaticController::class, 'bannerRemove'])
    ->name('image.banner.remove')
    ->middleware('auth');
Route::delete('user-avatar', [StaticController::class, 'avatarRemove'])
    ->name('image.avatar.remove')
    ->middleware('auth');

Route::get('/img/{path}', [StaticController::class, 'show'])
    ->where('path', '.*')
    ->name('img');

Route::get('download/purchases/{id}', [PurchaseController::class, 'downloadPurchases'])
    ->name('download.purchases')->middleware('auth');

// Auth

Route::get('/verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke'])
                ->middleware(['auth', 'signed', 'throttle:6,1'])
                ->name('verification.verify');
Route::get('verify-email', [EmailVerificationPromptController::class, '__invoke'])
    ->middleware(['auth'])
                ->name('verification.notice');
Route::get('login', [AuthenticatedSessionController::class, 'create'])
    ->name('login')
    ->middleware('guest');
Route::post('login', [AuthenticatedSessionController::class, 'store'])
    ->name('login.store')
    ->middleware('guest');
Route::delete('logout', [AuthenticatedSessionController::class, 'destroy'])
    ->name('logout');

Route::get('register', [RegisteredUserController::class, 'create'])
    ->name('register')
    ->middleware('guest');
Route::post('register', [RegisteredUserController::class, 'store'])
    ->name('register.store')
    ->middleware('guest');

Route::get('forgot-password', [PasswordResetLinkController::class, 'create'])
                ->name('password.request');
Route::post('forgot-password', [PasswordResetLinkController::class, 'store'])
                ->name('password.email');

Route::get('reset-password/{token}', [NewPasswordController::class, 'create'])
->name('password.reset');

Route::post('reset-password', [NewPasswordController::class, 'store'])
->name('password.store');

// Profile

Route::get('profile/{user}', [ProfileController::class, 'profile'])
    ->name('profile.user');

Route::get('profile/readable/{user}', [ProfileController::class, 'profileReaders'])
    ->name('profile.readers')
    ->middleware('auth');

Route::get('profile/subs/{user}', [ProfileController::class, 'profileSubs'])
    ->name('profile.subs')
    ->middleware('auth');

//Users
Route::post('users/verify-phone', [UsersController::class, 'verifyPhoneRequest'])
    ->name('users.phone.verify.request')
    ->middleware('auth');
Route::post('users/verify-phone/token', [UsersController::class, 'verifyPhone'])
    ->name('users.phone.verify.token')
    ->middleware('auth');

Route::get('users', [UsersController::class, 'index'])
    ->name('users.index')
    ->middleware('auth');
Route::get('users/document/{uuid}', [UsersController::class, 'readDocument'])
    ->name('users.get.document')
    ->middleware('auth');
Route::post('users/document', [UsersController::class, 'addDocument'])
    ->name('users.document')
    ->middleware('auth');
Route::post('users/subs/{user}', [UsersController::class, 'subs'])
    ->name('users.subs')
    ->middleware('auth');
Route::post('users/leader/{user}', [UsersController::class, 'vote'])
    ->name('users.leader')
    ->middleware('auth');
Route::post('users/select-plan/{id}', [UsersController::class, 'plan'])
    ->name('users.plan')
    ->middleware('auth');
Route::post('users/test-balance', [UsersController::class, 'testPaid'])
    ->name('users.testPaid')
    ->middleware('auth');
Route::patch('users/auto-subs/{user}', [UsersController::class, 'settingsAutoSubs'])
    ->name('users.settingsAutoSubs')
    ->middleware('auth');
Route::post('users/remove-paid-subs/{user}', [UsersController::class, 'removePaidSubs'])
    ->name('users.removePaidSubs')
    ->middleware('auth');
Route::post('users/auto-paid-subs-user/{user}', [UsersController::class, 'settingsAutoSubsPaidUser'])
    ->name('users.settingsPaidSubsUser')
    ->middleware('auth');

Route::post('users/posts-count/{user}', [UsersController::class, 'postsCount'])
    ->name('user.posts.count');

Route::put('users/{user}', [UsersController::class, 'update'])
    ->name('users.update')
    ->middleware('auth');

Route::put('users/password/{user}', [UsersController::class, 'updatePassword'])
    ->name('users.update.password')
    ->middleware('auth');

Route::get('user-friend', [UsersController::class, 'friend'])
    ->name('users.friend')
    ->middleware('auth');

// Settings
Route::get('settings/profile', [SettingController::class, 'index'])
    ->name('setting.index')
    ->middleware('auth');
Route::get('settings/notify', [SettingController::class, 'notify'])
    ->name('setting.notify')
    ->middleware('auth');
Route::get('settings/tarif', [SettingController::class, 'tarif'])
    ->name('setting.tarif')
    ->middleware('auth');
Route::get('settings/money', [SettingController::class, 'money'])
    ->name('setting.money')
    ->middleware('auth');
Route::get('settings/purchases', [PurchaseController::class, 'index'])
    ->name('setting.purchases')
    ->middleware('auth');
Route::get('settings/purchases/{id}', [PurchaseController::class, 'show'])
    ->name('setting.show.purchases')
    ->middleware('auth');
Route::get('settings/likes', [SettingController::class, 'likes'])
    ->name('setting.likes')
    ->middleware('auth');
Route::get('settings/payouts', [SettingController::class, 'payouts'])
    ->name('setting.payouts')
    ->middleware('auth');
Route::get('settings/packet', [SettingController::class, 'packet'])
    ->name('setting.packet')
    ->middleware('auth');
Route::get('settings/verification', [SettingController::class, 'verification'])
    ->name('setting.verification')
    ->middleware('auth');
Route::get('settings/write-to-us', [SettingController::class, 'writeToUs'])
    ->name('setting.write-to-us')
    ->middleware('auth');
Route::get('settings/documents', [SettingController::class, 'documentsInfo'])
    ->name('setting.documents')
    ->middleware('auth');
// WRITE US
Route::get('common/write-to-us', [DashboardController::class, 'commonSendWriteToUs'])
    ->name('common.write-to-us.get');
Route::post('common/write-to-us', [DashboardController::class, 'sendWriteToUs'])
    ->name('common.write-to-us');

// FEED
Route::get('feed', [FeedsController::class, 'index'])
    ->name('feeds.layoutsidebar')
    ->middleware('auth');
Route::delete('feed/destroy/{feed}', [FeedsController::class, 'destroy'])
    ->name('feed.destroy')
    ->middleware('auth');
Route::post('feed-purchase/{id}', [FeedsController::class, 'purchase'])
    ->name('feed.purchase')
    ->middleware('auth');
Route::post('feeds/purchase-check/{id}', [FeedsController::class, 'purchase_check'])
    ->name('feeds.purchase_check')
    ->middleware('auth');
// Нужно проверить на доступ !!!!
Route::post('feeds/replace/{id}', [FeedsController::class, 'replace'])
    ->name('feeds.replace')
    ->middleware('auth');
//
Route::post('feed-like/{id}', [FeedsController::class, 'toggleLike'])
    ->name('feed.like')
    ->middleware('auth');
Route::post('audio-add-like/{id}', [FeedsController::class, 'audioLike'])
    ->name('feed.audio.like')
    ->middleware('auth');
Route::post('increment-view/{id}', [FeedsController::class, 'add_view_feed'])
    ->name('add.view.feed');

// Tags
Route::get('tag-explore/{tag}', [TagController::class, 'index'])
    ->name('feed.tags')
    ->middleware('auth');
Route::get('images/tag-{tag}', [TagController::class, 'listImagesTag'])
    ->name('list.images.tag')
    ->middleware('auth');
Route::get('videos/tag-{tag}', [TagController::class, 'listVideosTag'])
    ->name('list.videos.tag')
    ->middleware('auth');
Route::get('audios/tag-{tag}', [TagController::class, 'listMusicsTag'])
    ->name('list.musics.tag')
    ->middleware('auth');

// IMAGES
Route::post('images/{feed}', [ImagesController::class, 'update'])
    ->name('images.update')
    ->middleware('auth');
Route::resource('images', ImagesController::class)->except([
    'update', 'destroy'
]);


// VIDEOS
Route::post('videos/{feed}', [VideosController::class, 'update'])
    ->name('videos.update')
    ->middleware('auth');
Route::resource('videos', VideosController::class)->except([
    'update', 'destroy'
]);

//AUDIOS
Route::get('loaded-playlist', [MusicsController::class, 'loadedPlaylist'])
    ->name('loadedplaylist')
    ->middleware('auth');
Route::get('favorited-playlist', [MusicsController::class, 'favoritePlaylist'])
    ->name('favoriteplaylist')
    ->middleware('auth');
Route::post('musics/{feed}', [MusicsController::class, 'update'])
    ->name('musics.update')
    ->middleware('auth');
Route::resource('musics', MusicsController::class)->except([
    'update', 'destroy'
]);

//FEEDS BY TYPE DATA
Route::get('feed/image', [FeedsController::class, 'onlyImages'])
    ->name('feeds.layoutsidebar.image')
    ->middleware('auth');
Route::get('feed/video', [FeedsController::class, 'onlyVideos'])
    ->name('feeds.layoutsidebar.video')
    ->middleware('auth');
Route::get('feed/audio', [FeedsController::class, 'onlyMusics'])
    ->name('feeds.layoutsidebar.music')
    ->middleware('auth');

//complaint
Route::get('complaint/reason/{id}', [ComplaintController::class, 'index'])
    ->name('complaint.reason')
    ->middleware('auth');
Route::post('complaint/reason', [ComplaintController::class, 'store'])
    ->name('complaint.store')
    ->middleware('auth');
Route::get('complaint-comment/reason/{id}', [ComplaintController::class, 'commentIndex'])
    ->name('complaint.reason.comment')
    ->middleware('auth');
    Route::post('complaint-comment/reason', [ComplaintController::class, 'commentStore'])
    ->name('complaint.store.comment')
    ->middleware('auth');

Route::post('search-user-tag', [UsersController::class, 'searchUserTag'])
    ->name('user.tab.search')
    ->middleware('auth');

// Comments
Route::post('feed-comments/{id}', [CommentController::class, 'show'])
    ->name('comments.show');
Route::post('feed-comments/add/{id}', [CommentController::class, 'store'])
    ->name('comments.store')
    ->middleware('auth');
Route::post('feed-comments/children/{id}', [CommentController::class, 'children'])
    ->name('comments.children.show');
Route::post('feed-comments/remove/{id}', [CommentController::class, 'remove'])
    ->name('comments.remove');

//messenger
Route::get('messenger', [MessengerController::class, 'index'])
    ->name('messenger.index')
    ->middleware('auth');
Route::get('messenger/{id}', [MessengerController::class, 'show'])
    ->name('messenger.show')
    ->middleware('auth');
Route::post('messenger', [MessengerController::class, 'store'])
    ->name('messenger.store')
    ->middleware('auth');
Route::post('messenger-profile', [MessengerController::class, 'storeFromProfile'])
    ->name('messenger.store.profile')
    ->middleware('auth');
Route::post('messenger-create-room', [MessengerController::class, 'createRoom'])
    ->name('messenger.create.room')
    ->middleware('auth');
Route::post('messenger-check-room', [MessengerController::class, 'checkRoom'])
    ->name('messenger.chech.room')
    ->middleware('auth');

Route::post('messenger-banned-room', [MessengerController::class, 'freezeRoom'])
    ->name('messenger.banned.room')
    ->middleware('auth');

Route::delete('messenger/message/{id}', [MessengerController::class, 'removeMessage'])
    ->name('messenger.message.remove')
    ->middleware('auth');

Route::post('messenger-banned-user-check', [MessengerController::class, 'checkBannedUser'])
    ->name('messenger.banned.user')
    ->middleware('auth');

Route::post('messenger-room-leave', [MessengerController::class, 'leaveRoom'])
    ->name('messenger.leave.room')
    ->middleware('auth');

Route::get('/actions-to-payments', [MoneyController::class, 'startProcess'])
    ->name('actions.start')
    ->middleware('auth');
Route::get('/unitpay-to-payments/status', [MoneyController::class, 'unitpayStatus'])
    ->name('unitpay.status')
    ->middleware('auth');

Route::get('/interkassa-to-payments', [MoneyController::class, 'interkassa'])
    ->name('interkassa.start')
    ->middleware('auth');
Route::get('/interkassa-to-payments/status', [MoneyController::class, 'interkassaStatus'])
    ->name('interkassa.status')
    ->middleware('auth');

Route::get('/qiwi-to-payments/status/{number}', [MoneyController::class, 'qiwiStatus'])
    ->name('qiwi.status')
    ->middleware('auth');

Route::get('/payments/status/{number}', [MoneyController::class, 'paymentStatus'])
    ->name('payments.status')
    ->middleware('auth');

Route::post('/payouts-start', [MoneyController::class, 'payouts'])
    ->name('payouts.start')
    ->middleware('auth');

Route::post('/payouts-check/{id}', [MoneyController::class, 'checkPointPay'])
    ->name('payouts.checkPointPay')
    ->middleware('auth');


Route::post('/requisites-bank', [RequisitesController::class, 'updateBank'])
    ->name('requisites.bank')
    ->middleware('auth');

Route::post('/user-package', [UserPackageController::class, 'update'])
    ->name('user.package.update')
    ->middleware('auth');

Route::post('/user-package/subs', [UserPackageController::class, 'subs'])
    ->name('user.package.subs')
    ->middleware('auth');


Route::get('/company/offer', function(){
    return response('', 410);
});
Route::get('/company/terms-payment', function(){
    return response('', 410);
});
Route::get('/company/terms-service', function(){
    return response('', 410);
});
Route::get('/company/cookies', function(){
    return response('', 410);
});

Route::get('/company/about', function(){
    return response('', 410);
});

Route::get('/company/privacy-policy', function(){
    return response('', 410);
});
