<?php

use Illuminate\Http\Request;
// use App\Http\Controllers\ConektaController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\ConektaController;
use App\Http\Controllers\Auth\AuthController;
use App\Http\Controllers\Auth\RegisterController;
use App\Http\Controllers\Auth\SocialAuthController;
use App\Http\Controllers\Auth\VerificationPhoneController;
use App\Http\Controllers\Auth\ResetPasswordPhoneController;
use App\Http\Controllers\Auth\ForgotPasswordPhoneController;

/*
|--------------------------------------------------------------------------
| 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([
    'middleware' => 'api',
    'prefix' => 'auth',
], function () {
    Route::post('/login', [AuthController::class, 'login']);
    Route::post('/logout', [AuthController::class, 'logout']);
    Route::get('/refresh', [AuthController::class, 'refresh']);
    Route::get('/user', [AuthController::class, 'user']);
    Route::post('/register', [RegisterController::class, 'register']);

    Route::post('password/phone', [ForgotPasswordPhoneController::class, 'sendResetCodePhoneNumber']);
    Route::post('password/resend', [ForgotPasswordPhoneController::class, 'resendResetCodePhoneNumber']);
    Route::post('password/code', [ResetPasswordPhoneController::class, 'code']);
    Route::post('password/reset', [ResetPasswordPhoneController::class, 'reset']);
    
    Route::post('phone/send', [VerificationPhoneController::class, 'send']);
    Route::post('phone/verify', [VerificationPhoneController::class, 'verify']);
    Route::post('phone/resend', [VerificationPhoneController::class, 'resend']);

    Route::get('/{provider}/callback', [SocialAuthController::class, 'handleProviderCallback']);
});

// Route::post('conekta/webhook', [ConektaController::class, 'handleWebhook'])->name('conekta.handleWebhook');
