<?php

namespace Database\Seeders;

use App\Models\GenericBackoffice\MenuItem;
use Illuminate\Database\Seeder;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;

class MenuItemsTableSeeder extends Seeder
{
    private $table = 'menu_items';
    private $langTable = 'menu_items_lang';

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // Table already deleted in DatabaseSeeder

        $now = Carbon::now();

        DB::table($this->table)->insert(
            [
                // Top Menu
                [
                    'id'            => 1,
                    'parent_id'     => null,
                    'menu_id'       => 1,
                    'entry_id'      => 1,
                    'target'        => null,
                    'position'      => 1,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 2,
                    'parent_id'     => null,
                    'menu_id'       => 1,
                    'entry_id'      => 2,
                    'target'        => null,
                    'position'      => 2,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 3,
                    'parent_id'     => null,
                    'menu_id'       => 1,
                    'entry_id'      => 3,
                    'target'        => null,
                    'position'      => 3,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 4,
                    'parent_id'     => null,
                    'menu_id'       => 1,
                    'entry_id'      => 4,
                    'target'        => null,
                    'position'      => 4,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 5,
                    'parent_id'     => null,
                    'menu_id'       => 1,
                    'entry_id'      => 5,
                    'target'        => null,
                    'position'      => 5,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 6,
                    'parent_id'     => null,
                    'menu_id'       => 1,
                    'entry_id'      => 6,
                    'target'        => null,
                    'position'      => 6,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 7,
                    'parent_id'     => null,
                    'menu_id'       => 1,
                    'entry_id'      => 7,
                    'target'        => null,
                    'position'      => 7,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 8,
                    'parent_id'     => null,
                    'menu_id'       => 1,
                    'entry_id'      => 8,
                    'target'        => null,
                    'position'      => 8,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_EXPDOT_TYPE
                ],

                // Footer Menu
                [
                    'id'            => 9,
                    'parent_id'     => null,
                    'menu_id'       => 3,
                    'entry_id'      => 9,
                    'target'        => null,
                    'position'      => 1,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 10,
                    'parent_id'     => null,
                    'menu_id'       => 3,
                    'entry_id'      => 10,
                    'target'        => null,
                    'position'      => 2,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 11,
                    'parent_id'     => null,
                    'menu_id'       => 3,
                    'entry_id'      => 11,
                    'target'        => null,
                    'position'      => 3,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 12,
                    'parent_id'     => null,
                    'menu_id'       => 3,
                    'entry_id'      => 12,
                    'target'        => null,
                    'position'      => 4,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 13,
                    'parent_id'     => null,
                    'menu_id'       => 3,
                    'entry_id'      => 13,
                    'target'        => null,
                    'position'      => 5,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ],
                [
                    'id'            => 14,
                    'parent_id'     => null,
                    'menu_id'       => 3,
                    'entry_id'      => 14,
                    'target'        => null,
                    'position'      => 6,
                    'active'        => 1,
                    'created_at'    => $now,
                    'type'          => MenuItem::MENU_ITEM_DEFAULT_TYPE
                ]
            ]
        );

        DB::table($this->langTable)->insert(
            [
                [
                    'translation_id'    => 1,
                    'menu_item_id'      => 1,
                    'language_id'       => 'en',
                    'title'             => 'Home',
                    'url'               => '/'
                ],
                [
                    'translation_id'    => 2,
                    'menu_item_id'      => 2,
                    'language_id'       => 'en',
                    'title'             => 'Capabilities',
                    'url'               => '/capabilities'
                ],
                [
                    'translation_id'    => 3,
                    'menu_item_id'      => 3,
                    'language_id'       => 'en',
                    'title'             => 'Work',
                    'url'               => '/work'
                ],
                [
                    'translation_id'    => 4,
                    'menu_item_id'      => 4,
                    'language_id'       => 'en',
                    'title'             => 'Team',
                    'url'               => '/team'
                ],
                [
                    'translation_id'    => 5,
                    'menu_item_id'      => 5,
                    'language_id'       => 'en',
                    'title'             => 'Careers',
                    'url'               => '/careers'
                ],
                [
                    'translation_id'    => 6,
                    'menu_item_id'      => 6,
                    'language_id'       => 'en',
                    'title'             => 'Blog',
                    'url'               => '/blog'
                ],
                [
                    'translation_id'    => 7,
                    'menu_item_id'      => 7,
                    'language_id'       => 'en',
                    'title'             => 'Contacts',
                    'url'               => '/contacts'
                ],
                [
                    'translation_id'    => 8,
                    'menu_item_id'      => 8,
                    'language_id'       => 'en',
                    'title'             => 'Estimate Project',
                    'url'               => '/estimate'
                ],

                [
                    'translation_id'    => 9,
                    'menu_item_id'      => 9,
                    'language_id'       => 'en',
                    'title'             => 'Discovery',
                    'url'               => '/capabilities/discovery-exploration'
                ],
                [
                    'translation_id'    => 10,
                    'menu_item_id'      => 10,
                    'language_id'       => 'en',
                    'title'             => 'Strategy',
                    'url'               => '/capabilities/digital-solutions-strategy'
                ],
                [
                    'translation_id'    => 11,
                    'menu_item_id'      => 11,
                    'language_id'       => 'en',
                    'title'             => 'Design',
                    'url'               => '/capabilities/prototyping-design'
                ],
                [
                    'translation_id'    => 12,
                    'menu_item_id'      => 12,
                    'language_id'       => 'en',
                    'title'             => 'Development',
                    'url'               => '/capabilities/digital-development'
                ],
                [
                    'translation_id'    => 13,
                    'menu_item_id'      => 13,
                    'language_id'       => 'en',
                    'title'             => 'Branding',
                    'url'               => '/capabilities/digital-branding'
                ],
                [
                    'translation_id'    => 14,
                    'menu_item_id'      => 14,
                    'language_id'       => 'en',
                    'title'             => 'Marketing',
                    'url'               => '/capabilities/digital-marketing'
                ]
            ]
        );
    }
}
