<?php

namespace App\Providers;

use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

class RouteServiceProvider extends ServiceProvider
{
    /**
     * This namespace is applied to your controller routes.
     *
     * In addition, it is set as the URL generator's root namespace.
     *
     * @var string
     */
    protected $namespace = 'App\Http\Controllers';

    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @return void
     */
    public function boot()
    {
        //

        parent::boot();
    }

    /**
     * Define the routes for the application.
     *
     * @return void
     */
    public function map()
    {
        $this->mapApiRoutes();

        $this->mapWebRoutes();

        $this->mapCallbacksRoutes();

        $this->mapGoodnightRoutes();

        $this->mapShareRoutes();

        $this->mapPairRoutes();

        $this->mapAdminRoutes();

        $this->mapAppRoutes();

        $this->mapDeedRoutes();

        $this->mapFriendRoutes();

        $this->mapGteamRoutes();

        $this->mapCommonRoutes();

        $this->mapMediaRoutes();

        $this->mapUserRoutes();

        $this->mapHomeRoutes();

        $this->mapLogRoutes();

        $this->mapAuthRoutes();

        $this->mapPayRoutes();

        $this->mapSyjRoutes();

        $this->mapLikeInviteRoutes();

        $this->mapOpenidRoutes();

        $this->mapQQprogramRoutes();

        $this->mapSignRoutes();

        $this->mapChargePartnerRoutes();

        $this->mapStubApiRoutes();
    }

    /**
     * Define the "web" routes for the application.
     *
     * These routes all receive session state, CSRF protection, etc.
     *
     * @return void
     */
    protected function mapWebRoutes()
    {
        Route::namespace($this->namespace)
            ->middleware('web')
            ->group(base_path('routes/web.php'));
    }

    /**
     * Define the "api" routes for the application.
     *
     * These routes are typically stateless.
     *
     * @return void
     */
    protected function mapApiRoutes()
    {
        Route::prefix('api')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/api.php'));
    }

    protected function mapCallbacksRoutes()
    {
        Route::namespace($this->namespace)
            ->group(base_path('routes/callbacks.php'));
    }

    protected function mapGoodnightRoutes()
    {
        Route::prefix('api/goodnight')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/goodnight.php'));
    }

    protected function mapShareRoutes()
    {
        Route::prefix('api/share')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/share.php'));
    }

    protected function mapPairRoutes()
    {
        Route::prefix('api/pair')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/pair.php'));
    }

    protected function mapAdminRoutes()
    {
        Route::prefix('api/admin')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/admin.php'));
    }

    protected function mapAppRoutes()
    {
        Route::prefix('api/app')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/app.php'));
    }

    protected function mapDeedRoutes()
    {
        Route::prefix('api/deed')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/deed.php'));
    }

    protected function mapFriendRoutes()
    {
        Route::prefix('api/friend')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/v2_17_3/friend.php'));
    }

    protected function mapGteamRoutes()
    {
        Route::prefix('api/gteam')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/gteam.php'));
    }

    protected function mapCommonRoutes()
    {
        Route::prefix('api/common')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/common.php'));
    }

    protected function mapMediaRoutes()
    {
        Route::prefix('api/media')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/media.php'));
    }

    protected function mapUserRoutes()
    {
        Route::prefix('api/user')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/user.php'));
    }

    protected function mapHomeRoutes()
    {
        Route::prefix('api/home')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/home.php'));
    }

    protected function mapLogRoutes()
    {
        Route::prefix('api/log')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/log.php'));
    }

    protected function mapAuthRoutes()
    {
        Route::prefix('api/auth')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/auth.php'));
    }

    protected function mapPayRoutes()
    {
        Route::prefix('api/pay')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/pay.php'));
    }

    protected function mapSyjRoutes()
    {
        Route::prefix('api/syj')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/syj.php'));
    }


    protected function mapLikeInviteRoutes()
    {
        Route::prefix('api/likeinvite')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/likeinvite.php'));
    }

    protected function mapOpenidRoutes()
    {
        Route::prefix('api/openid')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/openid.php'));
    }

    protected function mapQQprogramRoutes()
    {
        Route::prefix('api/qqprogram')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/qqprogram.php'));
    }

    protected function mapSignRoutes()
    {
        Route::prefix('api/sign')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/sign.php'));
    }

    protected function mapChargePartnerRoutes()
    {
        Route::prefix('')
            ->namespace($this->namespace)
            ->middleware('api')
            ->group(base_path('routes/chargePartner.php'));
    }

    protected function mapStubApiRoutes()
    {
        Route::prefix('stub-api')
            ->namespace('App\Generated\Controllers')
            ->middleware('stub-api')
            ->group(base_path('routes/generated_routes.php'));
    }
}
