<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Service\OrderController;
use App\Http\Controllers\Service\UserController;
use App\Http\Controllers\Service\GuideController;
use App\Http\Controllers\ChatController;
use App\Http\Controllers\Server\CommentController;
Route::middleware(['auth:sanctum'])->group(function (){
    Route::post('bind/service/users/{service_user}', [UserController::class, 'bindServiceUser'])->name('mp.servicer.bind.user');
    Route::get('service/users/{service_user}', [UserController::class, 'showServiceUser'])->name('mp.servicer.user');
    Route::middleware(['servicer'])->group(function() {
        /**
         * 订单
         */
        Route::get('orders', [OrderController::class, 'orders'])->name('mp.serivcer.orders');
        Route::get('orders/{order}', [OrderController::class, 'order'])->name('mp.serivcer.order');

        /**
         * 用户信息
         */
        Route::get('users/{user}/info', [UserController::class, 'userInfo'])->name('mp.servicer.info');
        Route::get('users/{user}/medical/reports', [UserController::class, 'medicalReports'])->name('mp.medical.reports');
        Route::get('users/{user}/guides', [GuideController::class, 'guides'])->name('mp.user.guides');

        /**
         * 群聊
         */
        //加入群聊
        Route::post('join/orders/{order}/group', [ChatController::class, 'serviceJoinGroup'])->name('mp.service.join.group');
        Route::post('join/orders/group/{group}', [ChatController::class, 'serviceJoinGroupV2'])->name('mp.service.join.group.v2');
        //发送聊天消息
        Route::post('send/groups/{group_id}/message', [ChatController::class, 'sendMessage'])->name("mp.service.send.group.message");

        /**
         * 备注
         */
        //订单备注列表
        Route::get('orders/{order}/comments', [CommentController::class, 'orderComments'])->name('mp.order.comments');
        //备注订单
        Route::post('orders/{order}/comment', [CommentController::class, 'commentOrder'])->name('mp.store.order.comment');
        //删除备注
        Route::delete('orders/comments/{comment}', [CommentController::class, 'deleteComment'])->name('mp.delete.order.comment');
        //备注修改
        Route::put('orders/comments/{comment}', [CommentController::class, 'updateOrderComment'])->name('mp.update.order.comment');
        //备注详情
        Route::get('orders/comments/{comment}', [CommentController::class, 'orderComment'])->name('mp.order.comment');
    });

});
