<?php

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::group([
    'namespace' => '\App\Http\Controllers\Api',
    'middleware' => 'api',
], static function () {
    Route::group([
        'prefix' => '/users',
        'namespace' => 'User'
    ], function () {
        // 不需要登录
        Route::group([
        ], function () {
            // 用户登录
            Route::post('login', 'AuthController@login');
            # gpt指令生成回调
            Route::post('gpt/callback', 'TaskController@gpt_callback');
            # 指令的回调地址
            Route::post('prompt/callback', 'TaskController@prompt_callback');
            # 图片下载完成回调
            Route::post('img/callback', 'TaskController@image_callback');
            // 获取上传策略
            Route::get('config/policy2', 'ConfigController@policy');
            # 图片切割回调接口
            Route::post('split/callback', 'TaskController@split_callback');
            # stable轮询获取任务
            Route::get('stable/task', 'TaskController@stableTask');
            # stable 回调
            Route::post('stable/callback', 'TaskController@stableCallback');
        });
        // 需要登录
        Route::group([
            'middleware' => 'auth:api',
        ], function () {
            // 退出登录
            Route::post('logout', 'AuthController@logout');
            // 获取上传策略
            Route::get('config/policy', 'ConfigController@policy');
            // 提交任务
            Route::post('submit', 'TaskController@SubmitTask');
            // Api 提交任务
            Route::post('api-submit', 'TaskController@apiSubmit');
            // stable 提交任务
            Route::post('stable-submit', 'TaskController@stableSubmit');
            # 轮询请求任务回调
            Route::get('task/callback', 'TaskController@task_callback');
            # 创建切割图片任务
            Route::post('split', 'TaskController@split_img');
            # 轮询请求切割后的图片地址
            Route::get('split/status', 'TaskController@split_img_result');

        });
    });
    # GPT
//    Route::group([
//        'prefix' => '/gpt',
//        'namespace' => 'GPT'
//    ], function () {
//        // 不需要登录
//        Route::group([
//        ], function () {
//            // 用户登录
//            # Route::post('login', 'AuthController@login');
//        });
//        // 需要登录
//        Route::group([
//            'middleware' => ['auth:api'],
//        ], function () {
//            // 提交对话内容
//            Route::post('/chat', 'ChatController@chat');
//            # 会话
//            Route::get('/stream', 'ChatController@stream');
//        });
//    });
});
