<?php


Header('Access-Control-Allow-Origin: *');
Header('Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS');
Header('Access-Control-Allow-Headers: Content-Type, Accept, Authorization');

Header("HTTP/1.1 200 OK");
Header("content-type:text/xml");


use Illuminate\Http\Request;
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(['prefix' => 'api'], function () {

    Route::post('LoginAction', 'Auth\AuthController@LoginAccountActionPost');
    Route::post('ActionBanAccountUseHack', 'Auth\AntiHackController@ActionBanAccountUseHack');
    Route::post('RegisterAction', 'Auth\AuthController@RegisterAccountActionPost');

    Route::get('GetAllCharacters', 'CharController@GetAllCharacters');
    Route::get('GetUserCharacters/{username}', 'CharController@GetUserCharacters');
    Route::get('GetCharacterData/{char_id}/{table_name}', 'CharController@GetCharacterData');
    Route::post('UpdateCharacterData/{char_id}/{table_name}', 'CharController@UpdateCharacterData');
    Route::post('SendItemToCharacter', 'CharController@SendItemToCharacter');

    // Получение и обновление предмета по char_item_id в нужной таблице
    Route::get('GetCharItem/{table}/{char_item_id}', 'CharController@GetCharItem');
    Route::post('UpdateCharItem/{table}/{char_item_id}', 'CharController@UpdateCharItem');
    
    // Получение RecId предметов из CashShopAll
    Route::get('getItemsDetails', 'Cash\CashShopController@getItemsDetails');
    
    // Получение и обновление квеста по char_id и RecId, {table?} — опционально, по умолчанию CharQuest    
    Route::get('GetCharQuest/{char_id}/{rec_id}/{table?}', 'CharController@GetCharQuest');
    Route::post('UpdateCharQuest/{char_id}/{rec_id}/{table?}', 'CharController@UpdateCharQuest');    
    
    // Получение и обновление письма по char_id и MailDBKey
    Route::get('GetCharMail/{char_id}/{mail_id}', 'CharController@GetCharMail');
    Route::post('UpdateCharMail/{char_id}/{mail_id}', 'CharController@UpdateCharMail');
    Route::post('SendItemViaMail', 'CharController@SendItemViaMail');
    
    Route::group(['prefix' => 'funcs_adm'], function () {
        Route::get('UpdateCharItemAccount/{CharID?}', 'ADMIN\AdminController@UpdateCharItemAccount');
        Route::get('CheckCharItemAccount/{CharID?}/{StrRecordKind?}', 'ADMIN\AdminController@CheckCharItemAccount');
        Route::post('SendItemForAccount', 'ADMIN\AdminController@SendItemForAccount');
        Route::get('GetAccountsSpecialChar', 'ADMIN\AdminController@GetAccountsSpecialChar');
        Route::get('GetPCID', 'ADMIN\\AdminController@GetPCID');
    });

});

Route::group(['prefix' => 'nexon'], function () {
    Route::get('loginCheck/loginCheck', 'Auth\AuthController@LoginAccountCheck');
    Route::post('inquiryBalance/json', 'Cash\CashShopController@inquiryBalance');
    Route::post('nexonCash/charge/json', 'Cash\CashShopController@nexonCash');
    Route::post('purchaseItem/json', 'Cash\CashShopController@purchaseItem');
});
