<?php

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




$api = app('Dingo\Api\Routing\Router');

$api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($api) {


    //附件下载
    $api->get('attachment/download/{md5}', [
        'as' => 'attachment.download',
        'uses' => 'AttachmentController@download',
    ]);
    //附件上传
    $api->post('attachment/upload', [
        'as' => 'attachment.upload',
        'uses' => 'AttachmentController@upload',
    ]);
    //附件删除
    $api->get('attachment/delete/{md5}', [
        'as' => 'attachment.delete',
        'uses' => 'AttachmentController@delete',
    ]);
    //上传头像
    $api->post('auth/avatar', [
        'as' => 'auth.avatar',
        'uses' => 'AuthController@avatar',
    ]);


    // test
    $api->get('test', [
        'as' => 'test',
        'uses' => 'AuthController@test',
    ]);
    // Auth
    // signin
    $api->post('auth/login', [
        'as' => 'auth.login',
        'uses' => 'AuthController@login',
    ]);
    $api->get('auth/logout', [
        'as' => 'auth.logout',
        'uses' => 'AuthController@logout',
    ]);
    $api->post('auth/code', [
        'as' => 'auth.code',
        'uses' => 'AuthController@getCode',
    ]);
    // signup
    $api->post('auth/register', [
        'as' => 'auth.register',
        'uses' => 'AuthController@register',
    ]);
    $api->post('auth/password', [
        'as' => 'auth.reset',
        'uses' => 'AuthController@setPassword',
    ]);
    $api->post('auth/check_password', [
        'as' => 'auth.check_password',
        'uses' => 'AuthController@check_password',
    ]);
    $api->post('auth/reset', [
        'as' => 'auth.reset',
        'uses' => 'AuthController@reset',
    ]);
    $api->get('auth/is_login', [
        'as' => 'auth.is_login',
        'uses' => 'AuthController@isLogin',
    ]);



//首页
    $api->get('index/home', [
        'as' => 'index.home',
        'uses' => 'IndexController@home',
    ]);
    $api->get('index/search', [
        'as' => 'index.search',
        'uses' => 'IndexController@search',
    ]);
    $api->get('index/user_search', [
        'as' => 'index.user_search',
        'uses' => 'IndexController@userSearch',
    ]);

//我的
    $api->get('my/show', [
        'as' => 'my.show',
        'uses' => 'MyController@show',
    ]);
    $api->get('my/persona', [
        'as' => 'my.persona',
        'uses' => 'MyController@persona',
    ]);
    $api->get('my/edit', [
        'as' => 'my.edit',
        'uses' => 'MyController@edit',
    ]);
    $api->post('my/update', [
        'as' => 'my.update',
        'uses' => 'MyController@update',
    ]);
//    充值
    $api->post('my/recharge', [
        'as' => 'my.recharge',
        'uses' => 'MyController@recharge',
    ]);
    $api->get('my/system_info', [
        'as' => 'my.system_info',
        'uses' => 'MyController@systemInfo',
    ]);
    $api->get('my/reply_my', [
        'as' => 'my.reply_my',
        'uses' => 'MyController@replyMy',
    ]);
    $api->get('my/dream', [
        'as' => 'my.dream',
        'uses' => 'MyController@dream',
    ]);
//    我的收藏
    $api->get('my/collection', [
        'as' => 'my.collection',
        'uses' => 'MyController@collection',
    ]);
    $api->get('my/setting', [
        'as' => 'my.setting',
        'uses' => 'MyController@setting',
    ]);
//    用户信息
    $api->get('user/show', [
        'as' => 'user.show',
        'uses' => 'HomeController@show',
    ]);
//    梦想
    $api->get('dream/show', [
        'as' => 'dream.show',
        'uses' => 'DreamController@show',
    ]);
    $api->get('dream/search', [
        'as' => 'dream.search',
        'uses' => 'DreamController@search',
    ]);
    $api->get('dream/collection', [
        'as' => 'dream.collection',
        'uses' => 'DreamController@collection',
    ]);
    $api->post('dream/support', [
        'as' => 'dream.support',
        'uses' => 'DreamController@support',
    ]);
    $api->post('dream/store', [
        'as' => 'dream.store',
        'uses' => 'DreamController@store',
    ]);
//    interaction  动态
    $api->post('interaction/store', [
        'as' => 'interaction.store',
        'uses' => 'InteractionController@store',
    ]);
    $api->post('interaction/comments', [
        'as' => 'interaction.comments',
        'uses' => 'InteractionController@comments',
    ]);
    $api->post('interaction/reply', [
        'as' => 'interaction.reply',
        'uses' => 'InteractionController@reply',
    ]);
});