<?php

use App\Http\Controllers\Client\AccountController;
use App\Http\Controllers\Client\UserController;
use App\Http\Controllers\ScribeController;
use Illuminate\Support\Facades\Route;

// API文档相关
Route::get('scribe/update-token/{mobile}', [ScribeController::class, 'updateAuthToken']);

// 无需认证的公开路由
Route::prefix('account')->group(function () {
    // 发送验证码
    Route::post('send-code', [AccountController::class, 'sendVerifyCode']);
    // 手机号登录
    Route::post('login', [AccountController::class, 'login']);
    // 微信登录
    Route::post('wx-login', [AccountController::class, 'wxLogin']);
});

// 需要认证的路由组
Route::middleware('auth:sanctum')->group(function () {
    // 账号相关
    Route::prefix('account')->group(function () {
        // 退出登录
        Route::post('logout', [AccountController::class, 'logout']);
        // 注销账号
        Route::delete('/', [AccountController::class, 'destroy']);
    });

    // 用户相关
    Route::prefix('user')->group(function () {
        // 获取用户信息
        Route::get('info', [UserController::class, 'getUserInfo']);
        // 更新用户信息
        Route::put('info', [UserController::class, 'updateUserInfo']);
        // 获取钱包信息
        Route::get('wallet', [UserController::class, 'getUserWallet']);
        // 提现
        Route::post('withdraw', [UserController::class, 'withdraw']);
    
        // 用户反馈
        Route::post('feedback', [UserController::class, 'feedback']);
        // 申请成为技师
        Route::post('apply-coach', [UserController::class, 'applyCoach']);
    });
});
