<?php

use App\Domains\Integration\Controllers\ClientIntegrationController;
use App\Domains\Integration\Controllers\IntegrationController;
use App\Domains\Integration\Controllers\TelepagosWebhookController;
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' => 'clients/{client}/integrations'], function () {
    Route::get('/', [ClientIntegrationController::class, 'index']);
    Route::get('/{integration_code}', [ClientIntegrationController::class, 'show']);
    Route::put('/{integration_code}', [ClientIntegrationController::class, 'store']);
});

Route::post('webhooks/telepagos/{client}', [TelepagosWebhookController::class, 'handle']);
