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

namespace BplanBase\Globals\Database\Seeders;


use Illuminate\Database\Seeder;


/**
 * Seeder Class
 *
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 */
class DatabaseSeeder extends Seeder
{


    /**
     * Seed the application's database.
     */
    public function run(): void
    {
        $env = strtolower(config('app.env'));

        $seeds = [];

        $seeds = [
            RegisterModuleSeeder::class,
            CountrySeeder::class,
            ExternalSystemSeeder::class,
            LocationTypeSeeder::class,
            CombinedTenantSeeder::class,
            LanguageSeeder::class,
            CombinedUserSeeder::class,
            GlobalSettingSeeder::class,
            /*
                @todo   Muss später entfernt werden und es muss eine bessere Lösung gefunden werden. Für Dev okay.
                        Bessere Variante für ein Produktivsystem: Token automatisch erzeugen und ins setup.log schreiben.
            */
            PersonalAccessTokenSeeder::class,

        ];
        if ($env === 'production' || config('globals.dev.seed-production')) {
            if ($env !== 'production' && config('globals.dev.seed-production')) {
                $seeds[] = Dev\CombinedUserSeeder::class;
            }
        } elseif (str_starts_with($env, 'demo') === true) {
            $seeds[] = Demo\CombinedTenantSeeder::class;
            $seeds[] = Demo\CombinedUserSeeder::class;
            $seeds[] = Dev\CombinedUserSeeder::class;

        } else {
            // $seeds[] = Dev\CombinedTenantSeeder::class;
            // $seeds[] = Dev\TenantExternalSystemSeeder::class;
            $seeds[] = Dev\CombinedUserSeeder::class;
        }
        /*
        **  EntityTypes seeden
        **
        **  Individual          -   Model, EntityType und Fields seeden. */
        $seeds[] = EntityTypes\IndividualModelSeeder::class;
        $seeds[] = EntityTypes\IndividualSeeder::class;
        $seeds[] = EntityTypes\IndividualFieldSeeder::class;
        /*
        **  Individual.Employee -   EntityType und Fields seeden. */
        // $seeds[] = EntityTypes\IndividualEmployeeSeeder::class;
        // $seeds[] = EntityTypes\IndividualEmployeeFieldSeeder::class;

        if ($env === 'production' || config('globals.dev.seed-production')) {
            $seeds[] = Project\TenantSeeder::class;
            $seeds[] = Project\UserSeeder::class;
            $seeds[] = Project\SettingSeeder::class;

        } elseif (str_starts_with($env, 'demo') === true) {
            $seeds[] = Project\TenantSeeder::class;
            $seeds[] = Project\UserSeeder::class;
            $seeds[] = Project\SettingSeeder::class;
        } else {
            $seeds[] = Project\TenantSeeder::class;
            $seeds[] = Project\UserSeeder::class;
            $seeds[] = Project\SettingSeeder::class;
            /*
            **  Individual.Employee -   Daten seeden. */
            $seeds[] = EntityTypes\IndividualEmployeeSeeder::class;
            $seeds[] = EntityTypes\IndividualEmployeeFieldSeeder::class;
            $seeds[] = Dev\EntityTypes\IndividualEmployeeDataSeeder::class;
        }
        $this->call($seeds);

    } // run()


} // class DatabaseSeeder extends Seeder
