<?php

use App\Domains\Integration\Controllers\IntegrationController;
use App\Domains\Integration\Controllers\TenantIntegrationController;
use Illuminate\Support\Facades\Route;

Route::group(['prefix' => 'integrations'], function () {
    Route::get('/', [IntegrationController::class, 'index']);
    Route::post('/', [IntegrationController::class, 'store']);
    Route::get('/{integration}', [IntegrationController::class, 'show']);
    Route::put('/{integration}', [IntegrationController::class, 'update']);
    Route::delete('/{integration}', [IntegrationController::class, 'destroy']);
});

Route::group(['prefix' => '{tenant_code}/integrations'], function () {
    Route::get('/', [TenantIntegrationController::class, 'index']);
    Route::get('/{integration_code}', [TenantIntegrationController::class, 'show']);
    Route::post('/{integration_code}', [TenantIntegrationController::class, 'store']);
});

Route::post('webhooks/telepagos/{tenant_codigo}', [\App\Domains\Integration\Controllers\TelepagosWebhookController::class, 'handle']);
