<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| 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::middleware("auth:sanctum")->get("/user", function (Request $request) {
    return $request->user();
});

Route::resource(
    "/banner",
    \App\Http\Controllers\Api\BannerController::class
)->only(["index"]);
Route::resource(
    "/articles",
    \App\Http\Controllers\Api\ArticleController::class
)->only(["index"]);

Route::get("/home-articles", [
    \App\Http\Controllers\Api\ArticleController::class,
    "homeArticle",
]);

Route::get("/articles/{slug}", [
    \App\Http\Controllers\Api\ArticleController::class,
    "show",
]);
Route::resource(
    "/banner-product",
    \App\Http\Controllers\Api\BannerProductController::class
)->only(["index"]);

Route::resource(
    "/videos",
    \App\Http\Controllers\Api\VideosController::class
)->only(["index"]);
Route::resource(
    "/hosea",
    \App\Http\Controllers\Api\HoseaController::class
)->only(["index"]);
Route::get("/hosea/{slug}", [
    \App\Http\Controllers\Api\HoseaController::class,
    "show",
]);
Route::resource("/city", \App\Http\Controllers\Api\CityController::class)->only(
    ["index"]
);

Route::middleware("set.language")->group(function () {
    Route::resource(
        "/category",
        \App\Http\Controllers\Api\CategoryController::class
    )->only(["index"]);

    Route::resource(
        "/product",
        \App\Http\Controllers\Api\ProductController::class
    )->only(["index"]);
});
