<?php

declare(strict_types=1);

use Illuminate\Support\Facades\Route;
use ImovelZapAi\Billing\Presentation\Http\Controllers\BillingPlanController;
use ImovelZapAi\Billing\Presentation\Http\Controllers\MercadoPagoWebhookController;

Route::post('webhooks/mercadopago', MercadoPagoWebhookController::class)
    ->name('billing.webhooks.mercadopago');

Route::middleware([
    'web',
    'auth',
    'tenant.resolve',
    'tenant.required',
    'tenant.active',
    'role:Admin|Gestor',
])->group(function (): void {
    Route::get('plano', [BillingPlanController::class, 'index'])->name('billing.plan');
    Route::post('plano/checkout', [BillingPlanController::class, 'checkout'])->name('billing.checkout');
    Route::post('plano/alterar', [BillingPlanController::class, 'changePlan'])->name('billing.change-plan');
    Route::post('plano/cupom', [BillingPlanController::class, 'applyCoupon'])->name('billing.apply-coupon');
});
