<?php

use Illuminate\Support\Facades\Route;
use Modules\Order\Http\Controllers\APIController;
use Modules\Order\Http\Controllers\Controller;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::group(['as' => 'api.'], function () {
    Route::get('success', [APIController::class, 'success']);
    Route::get('failed', [APIController::class, 'failed']);

    Route::get('tabby-failure/{id}', [APIController::class, 'tabby_failure']);
    Route::get('tabby-cancel/{id}', [APIController::class, 'tabby_cancel']);
    Route::get('tabby-verify/{id}', [APIController::class, 'tabby_verify']);
    Route::get('tabby-too-high/{id}', [APIController::class, 'tabby_too_high']);
    Route::get('tabby-too-low/{id}', [APIController::class, 'tabby_too_low']);

    Route::get('/orders/tap/payments/response', [APIController::class, 'TapResponse']);
    Route::get('/orders/tap/payments/check', [APIController::class, 'TapCheck']);
    
    Route::prefix('/{lang}')->group(function () {
        Route::get('order/print/{id}', [Controller::class, 'print_pdf']);
        Route::get('order/download/{id}', [Controller::class, 'download_pdf']);
        Route::get('order/mail/{id}', [APIController::class, 'mail'])->name('order.mail');
        Route::get('order/payment/{id}', [APIController::class, 'payment'])->name('order.payment');
        Route::apiResource('order', APIController::class);
    });
});
