<?php
/**
 *
 * @version     1.0.$Revision:$
 * @version     SVN: $Id:$
 * @package     bplan-base/globals
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 * @copyright   Copyright (C) 2025 bplan-solutions GmbH & Co. KG <http://www.bplan-solutions.de/>
 * /Δ\
 */

use Illuminate\Support\Facades\Route;


use BplanBase\Globals\Http\Controllers\Core\DashboardController;
use BplanBase\Globals\Http\Controllers\Core\EntityTypeController;
use BplanBase\Globals\Http\Controllers\Core\EntityTypeFieldController;
use BplanBase\Globals\Http\Controllers\Core\ExternalSystemController;
use BplanBase\Globals\Http\Controllers\Core\LocationController;
use BplanBase\Globals\Http\Controllers\Core\LocationTypeController;
use BplanBase\Globals\Http\Controllers\Core\ModuleController;
use BplanBase\Globals\Http\Controllers\Core\ModuleTenantController;
use BplanBase\Globals\Http\Controllers\Core\RoleController;
use BplanBase\Globals\Http\Controllers\Core\SystemFieldController;
use BplanBase\Globals\Http\Controllers\Core\SystemInfoController;
use BplanBase\Globals\Http\Controllers\Core\TenantExternalSystemController;
use BplanBase\Globals\Http\Controllers\Core\TenantRecordController;
use BplanBase\Globals\Http\Controllers\Core\TenantController;
use BplanBase\Globals\Http\Controllers\Core\UserRecordController;
use BplanBase\Globals\Http\Controllers\Core\UserController;
use BplanBase\Globals\Http\Controllers\DummyController;


$packagePrefix = 'core';


Route::prefix($packagePrefix)
    ->middleware([
        'web',
        'auth:sanctum',
        'verified',

    ])->prefix('core')->group(function () {
        Route::get('/dashboard',                              [DashboardController::class,            'index'])->name('core-dashboard');

        Route::delete('/entity-types/{id}/delete',            [EntityTypeController::class,           'destroy'])->name('delete.core-entity-type');
        Route::get('/entity-types',                           [EntityTypeController::class,           'index'])->name('core-entity-types.index');
        Route::get('/entity-types/create',                    [EntityTypeController::class,           'create'])->name('create.core-entity-type');
        Route::get('/entity-types/{id}',                      [EntityTypeController::class,           'edit'])->name('core-entity-type');

        Route::delete('/entity-type-fields/{id}/delete',      [EntityTypeFieldController::class,      'destroy'])->name('delete.core-entity-type-field');
        Route::get('/entity-type-fields',                     [EntityTypeFieldController::class,      'index'])->name('core-entity-type-fields.index');
        Route::get('/entity-type-fields/create',              [EntityTypeFieldController::class,      'create'])->name('create.core-entity-type-field');
        Route::get('/entity-type-fields/{id}',                [EntityTypeFieldController::class,      'edit'])->name('core-entity-type-field');

        Route::delete('/external-systems/{id}/delete',        [ExternalSystemController::class,       'destroy'])->name('delete.core-external-system');
        Route::get('/external-systems',                       [ExternalSystemController::class,       'index'])->name('core-external-systems.index');
        Route::get('/external-systems/create',                [ExternalSystemController::class,       'create'])->name('create.core-external-system');
        Route::get('/external-systems/{id}',                  [ExternalSystemController::class,       'edit'])->name('core-external-system');

        // // Route::delete('/entity-type-fields/{id}/delete',      [EntityTypeFieldController::class,      'destroy'])->name('delete.core-entity-type-field');
        // // Route::get('/entity-type-fields',                     [EntityTypeFieldController::class,      'index'])->name('core.entity-type-fields');
        // // Route::get('/entity-type-fields/create',              [EntityTypeFieldController::class,      'create'])->name('create.core-entity-type-field');
        // // Route::get('/entity-type-fields/{id}',                [EntityTypeFieldController::class,      'edit'])->name('core.entity-type-field');

        Route::get('/location-types',                         [LocationTypeController::class,         'index'])->name('core-location-types.index');
        Route::get('/locations',                              [LocationController::class,             'index'])->name('core-locations.index');

        Route::delete('/modules/{id}/delete',                 [ModuleController::class,               'destroy'])->name('delete.core-module');
        Route::get('/modules',                                [ModuleController::class,               'index'])->name('core-modules.index');
        Route::get('/modules/create',                         [ModuleController::class,               'create'])->name('create.core-module');
        Route::get('/modules/{id}',                           [ModuleController::class,               'edit'])->name('core-module');

        Route::get('/roles',                                  [RoleController::class,                 'index'])->name('core-roles.index');

        Route::delete('/tenant-modules/{id}/delete',          [ModuleTenantController::class,         'destroy'])->name('delete.core-tenant-module');
        Route::get('/tenant-modules',                         [ModuleTenantController::class,         'index'])->name('core-tenant-modules.index');
        Route::get('/tenant-modules/create',                  [ModuleTenantController::class,         'create'])->name('create.core-tenant-module');
        Route::get('/tenant-modules/{id}',                    [ModuleTenantController::class,         'edit'])->name('core.tenant-module');

        // Route::delete('/system-fields/{id}/delete',           [SystemFieldController::class,          'destroy'])->name('delete.core-system-field');
        // Route::get('/system-fields',                          [SystemFieldController::class,          'index'])->name('core-system-fields.index');
        // Route::get('/system-fields/create',                   [SystemFieldController::class,          'create'])->name('create.core-system-field');
        // Route::get('/system-fields/{id}',                     [SystemFieldController::class,          'edit'])->name('core-system-field')
        // Route::get('/systeminfos',                            [SystemInfoController::class,           'index'])->name('core-systeminfos')

        Route::delete('/tenants/{id}/delete',                 [TenantController::class,               'destroy'])->name('delete.core-tenant');
        Route::get('/tenants',                                [TenantController::class,               'index'])->name('core-tenants.index');
        Route::get('/tenants/create',                         [TenantController::class,               'create'])->name('create.core-tenant');
        Route::get('/tenants/{id}',                           [TenantController::class,               'edit'])->name('core-tenant');

        Route::get('/tenant-records',                         [TenantRecordController::class,         'index'])->name('core-tenant-records.index') ;
        Route::get('/tenant-records/create',                  [TenantRecordController::class,         'create'])->name('create.core-tenant-record');
        Route::get('/tenant-records/{id}',                    [TenantRecordController::class,         'edit'])->name('core-tenant-record');

        Route::delete('/tenant-external-systems/{id}/delete', [TenantExternalSystemController::class, 'destroy'])->name('delete.core-tenant-external-system');
        Route::get('/tenant-external-systems',                [TenantExternalSystemController::class, 'index'])->name('core-tenant-external-systems.index');
        Route::get('/tenant-external-systems/create',         [TenantExternalSystemController::class, 'create'])->name('create.core-tenant-external-system');
        Route::get('/tenant-external-systems/{id}',           [TenantExternalSystemController::class, 'edit'])->name('core-tenant-external-system');

        Route::delete('/users/{id}/delete',                   [UserController::class,                 'destroy'])->name('delete.core-user');
        Route::get('/users',                                  [UserController::class,                 'index'])->name('core-users.index');
        Route::get('/users/create',                           [UserController::class,                 'create'])->name('create.core-user');
        Route::get('/users/{id}',                             [UserController::class,                 'edit'])->name('core-user');

        Route::delete('/user-records/{id}/delete',            [UserRecordController::class,           'destroy'])->name('delete.core-user-record');
        Route::get('/user-records',                           [UserRecordController::class,           'index'])->name('core-user-records.index');
        Route::get('/user-records/create',                    [UserRecordController::class,           'create'])->name('create.core-user-record');
        Route::get('/user-records/{id}',                      [UserRecordController::class,           'edit'])->name('core-user-record');

        Route::get('/dynamic-form-designer',                  fn () => view('globals::containers.dynamic-form-designer.index'))->name('core-dynamic-form-designer');

        Route::get('/{resource}', [DummyController::class, 'variousResourceIndex']);

    }
);
