<?php

use App\Http\Controllers\Api\V1\Entrepreneur\EntrepreneurAuthController;
use App\Http\Controllers\Api\V1\Entrepreneur\EntrepreneurOrderController;
use App\Http\Controllers\Api\V1\Entrepreneur\VendorMetricsController;
use App\Http\Controllers\Api\V1\Entrepreneur\VendorProductController;
use App\Http\Controllers\Api\V1\Entrepreneur\VendorProfileController;
use Illuminate\Support\Facades\Route;

// Auth...
Route::post('register', [EntrepreneurAuthController::class, 'register'])->name('register');
Route::post('verify-phone',[EntrepreneurAuthController::class,  'verifyPhoneNumber'])->name('verify-phone');
Route::post('verify-email',[EntrepreneurAuthController::class,  'verifyEmail'])->name('verify-email');
Route::post('finalize', [EntrepreneurAuthController::class, 'finalize'])->name('finalize');
Route::post('login', [EntrepreneurAuthController::class, 'login'])->name('login');

// Authenticated...
Route::middleware('auth:sanctum', 'role:vendor')->group(function () {
    // Products...
    Route::get('products', [VendorProductController::class, 'index'])->name('products.index');
    Route::get('products/{product}', [VendorProductController::class, 'show'])->name('products.show');
    Route::get('products/{product}/reviews', [VendorProductController::class, 'reviews'])->name('product.reviews');
    Route::post('products', [VendorProductController::class, 'store'])->name('products.store');
    Route::patch('products/{product}', [VendorProductController::class, 'update'])->name('products.update');
    Route::delete('products/{product}', [VendorProductController::class, 'destroy'])->name('products.delete');

    // Metrics...
    Route::get('/metrics', [VendorMetricsController::class, 'index']);

    // Orders...
    Route::get('orders', [EntrepreneurOrderController::class, 'index']);
    Route::get('orders/{order}', [EntrepreneurOrderController::class, 'show']);

    // Profiles...
    Route::get('profile', [VendorProfileController::class, 'index']);
});
