<?php

use Database\Seeders\BanksTableDevelopmentSeeder;
use Database\Seeders\CompaniesTableDevelopmentSeeder;
use Database\Seeders\CurrenciesTableDevelopmentSeeder;
use Database\Seeders\CurrencyRatesTableDevelopmentSeeder;
use Database\Seeders\SegmentConstantsTableDevelopmentSeeder;
use Database\Seeders\SegmentsTableDevelopmentSeeder;
use Database\Seeders\ServiceTypesTableDevelopmentSeeder;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        DB::beginTransaction();

        //General
        $this->call(CountriesTableSeeder::class);
        $this->call(CurrenciesTableSeeder::class);

        $this->call(StatesTableSeeder::class);
        $this->call(DistrictsTableSeeder::class);

        $this->call(SegmentsTableSeeder::class);
        $this->call(SegmentConstantsTableSeeder::class);

        $this->call(CompaniesTableSeeder::class);

        // Admin
        $this->call(AdminUserTableSeeder::class);
        $this->call(AdminUserPermissionsTableSeeder::class);

        if(App()->environment('local')){
            $this->call(CompaniesTableDevelopmentSeeder::class);
            $this->call(BanksTableDevelopmentSeeder::class);
            $this->call(ServiceTypesTableDevelopmentSeeder::class);
            $this->call(SegmentsTableDevelopmentSeeder::class);
            $this->call(SegmentConstantsTableDevelopmentSeeder::class);
            $this->call(CurrencyRatesTableDevelopmentSeeder::class);
        }

        DB::commit();
    }
}
