<?php #CodeGenerator V3 Δ 357e543f23d18b11f949d35814cc1e12 Δ DYNAMICALLY GENERATED FILE - Do not modify this line! Remove it completely to protect the file from changes.
/**
 * Route File
 *
 * @version     1.0.$Revision:$
 * @version     SVN: $Id:$
 * @version     STUB: 1.0.0
 * @generated   2026-03-27 09:40:36
 * @package     bplan-base/globals
 * @author      Emilio Cannarozzo <emilio.cannarozzo@bplan-solutions.de>
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 * @copyright   Copyright (C) 2025, 2026 bplan-solutions GmbH & Co. KG <https://www.bplan-solutions.de/>
 * /Δ\
 */


use Illuminate\Support\Facades\Route;
use LaravelJsonApi\Laravel\Facades\JsonApiRoute;
use LaravelJsonApi\Laravel\Http\Controllers\JsonApiController;
use LaravelJsonApi\Laravel\Routing\Relationships;
use LaravelJsonApi\Laravel\Routing\ResourceRegistrar;


JsonApiRoute::server('data')
    ->prefix('api/data')
    ->middleware('api')
    ->middleware('auth:sanctum')
    ->withoutMiddleware(\Illuminate\Routing\Middleware\SubstituteBindings::class)
    ->resources(function (ResourceRegistrar $Server) {

        $Server->resource('countries', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasMany('tenant-records')->readOnly();
            });

        $Server->resource('entity-type-fields', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('entity-type')->readOnly();
            });

        $Server->resource('entity-type-models', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasMany('entity-types')->readOnly();
            });

        $Server->resource('entity-types', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasMany('derived-entity-types')->readOnly();
                $Relations->hasMany('fields')->readOnly();
                $Relations->hasMany('individuals')->readOnly();
                $Relations->hasOne('master-entity-type')->readOnly();
                $Relations->hasOne('model')->readOnly();
                $Relations->hasOne('module')->readOnly();
                $Relations->hasOne('source-entity-type')->readOnly();
                $Relations->hasMany('sub-entity-types')->readOnly();
                $Relations->hasOne('tenant')->readOnly();
            });

        $Server->resource('external-systems', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasMany('tenant-external-systems')->readOnly();
            });

        $Server->resource('global-settings', JsonApiController::class)->except('store', 'destroy')
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('tenant')->readOnly();
            });

        $Server->resource('import-log-records', JsonApiController::class)->readOnly()
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('import-log')->readOnly();
            });

        $Server->resource('import-logs', JsonApiController::class)->readOnly()
            ->relationships(function (Relationships $Relations) {
                $Relations->hasMany('import-log-records')->readOnly();
                $Relations->hasOne('import-user')->readOnly();
                $Relations->hasOne('tenant')->readOnly();
            });

        $Server->resource('individuals', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('entity-type')->readOnly();
                $Relations->hasOne('user')->readOnly();
            });

        $Server->resource('languages', JsonApiController::class);

        $Server->resource('location-types', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasMany('locations')->readOnly();
            });

        $Server->resource('locations', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('location-type')->readOnly();
                $Relations->hasOne('master')->readOnly();
                $Relations->hasMany('sub-locations')->readOnly();
                $Relations->hasOne('tenant')->readOnly();
            });

        $Server->resource('module-tenants', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('module')->readOnly();
                $Relations->hasOne('tenant')->readOnly();
            });

        $Server->resource('modules', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasMany('entity-types')->readOnly();
                $Relations->hasMany('tenants')->readOnly();
            });

        $Server->resource('role-users', JsonApiController::class)->except('update')
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('role')->readOnly();
                $Relations->hasOne('user')->readOnly();
            });

        $Server->resource('roles', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('tenant')->readOnly();
                $Relations->hasMany('users')->readOnly();
            });

        $Server->resource('tenant-external-systems', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('external-system')->readOnly();
                $Relations->hasOne('tenant')->readOnly();
            });

        $Server->resource('tenant-locales', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('tenant')->readOnly();
            });

        $Server->resource('tenant-records', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('country')->readOnly();
                $Relations->hasOne('tenant')->readOnly();
            });

        $Server->resource('tenant-users', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('tenant')->readOnly();
                $Relations->hasOne('user')->readOnly();
            });

        $Server->resource('tenants', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasMany('assigned-users')->readOnly();
                $Relations->hasMany('entity-types')->readOnly();
                $Relations->hasMany('external-systems')->readOnly();
                $Relations->hasOne('global-setting')->readOnly();
                $Relations->hasMany('import-logs')->readOnly();
                $Relations->hasMany('locales')->readOnly();
                $Relations->hasMany('locations')->readOnly();
                $Relations->hasOne('master-tenant')->readOnly();
                $Relations->hasMany('modules')->readOnly();
                $Relations->hasMany('roles')->readOnly();
                $Relations->hasMany('sub-tenants')->readOnly();
                $Relations->hasOne('tenant-record')->readOnly();
                $Relations->hasMany('users')->readOnly();
            });

        $Server->resource('user-records', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasOne('user')->readOnly();
            });

        $Server->resource('users', JsonApiController::class)
            ->relationships(function (Relationships $Relations) {
                $Relations->hasMany('import-logs')->readOnly();
                $Relations->hasOne('individual')->readOnly();
                $Relations->hasMany('roles')->readOnly();
                $Relations->hasOne('tenant')->readOnly();
                $Relations->hasMany('tenants')->readOnly();
                $Relations->hasOne('user-record')->readOnly();
            });

    });

if (file_exists(__DIR__.'/custom.data.php')) {
    require_once __DIR__.'/custom.data.php';
}
