<?php

namespace Database\Seeders;

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

class EntriesTableSeeder extends Seeder
{
    private $table = 'entries';
    private $langTable = 'entries_lang';

    private $websiteTable = 'website_objects';
    private $websiteLangTable = 'website_objects_lang';

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

        $now = Carbon::now();

        DB::table($this->table)->insert(
            [
                [
                    'id'                => 1,
                    'parent_id'         => null,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 2,
                    'parent_id'         => null,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 3,
                    'parent_id'         => null,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 4,
                    'parent_id'         => null,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 5,
                    'parent_id'         => null,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 6,
                    'parent_id'         => null,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 7,
                    'parent_id'         => null,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 8,
                    'parent_id'         => null,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 9,
                    'parent_id'         => 2,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 10,
                    'parent_id'         => 2,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 11,
                    'parent_id'         => 2,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 12,
                    'parent_id'         => 2,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 13,
                    'parent_id'         => 2,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
                [
                    'id'                => 14,
                    'parent_id'         => 2,
                    'backend_user_id'   => 1,
                    'created_at'        => $now,
                    'meta_image_id'     => null
                ],
            ]
        );

        DB::table($this->langTable)->insert(
            [
                [
                    'translation_id'    => 1,
                    'entry_id'          => 1,
                    'language_id'       => 'en',
                    'title'             => 'Home',
                    'content'           => 'The home page',
                    'meta_title'        => 'home',
                    'meta_description'  => 'The home page'
                ],
                [
                    'translation_id'    => 2,
                    'entry_id'          => 2,
                    'language_id'       => 'en',
                    'title'             => 'Capabilities',
                    'content'           => 'The capabilities page',
                    'meta_title'        => 'capabilities',
                    'meta_description'  => 'The capabilities page'
                ],
                [
                    'translation_id'    => 3,
                    'entry_id'          => 3,
                    'language_id'       => 'en',
                    'title'             => 'Work',
                    'content'           => 'The work page',
                    'meta_title'        => 'work',
                    'meta_description'  => 'The work page'
                ],
                [
                    'translation_id'    => 4,
                    'entry_id'          => 4,
                    'language_id'       => 'en',
                    'title'             => 'Team',
                    'content'           => 'The team page',
                    'meta_title'        => 'team',
                    'meta_description'  => 'The team page'
                ],
                [
                    'translation_id'    => 5,
                    'entry_id'          => 5,
                    'language_id'       => 'en',
                    'title'             => 'Careers',
                    'content'           => 'The careers page',
                    'meta_title'        => 'careers',
                    'meta_description'  => 'The careers page'
                ],
                [
                    'translation_id'    => 6,
                    'entry_id'          => 6,
                    'language_id'       => 'en',
                    'title'             => 'Blog',
                    'content'           => 'The blog page',
                    'meta_title'        => 'blog',
                    'meta_description'  => 'The blog page'
                ],
                [
                    'translation_id'    => 7,
                    'entry_id'          => 7,
                    'language_id'       => 'en',
                    'title'             => 'Contacts',
                    'content'           => 'The contacts page',
                    'meta_title'        => 'contacts',
                    'meta_description'  => 'The contacts page'
                ],
                [
                    'translation_id'    => 8,
                    'entry_id'          => 8,
                    'language_id'       => 'en',
                    'title'             => 'Estimate Project',
                    'content'           => 'Get your estimate',
                    'meta_title'        => 'estimate',
                    'meta_description'  => 'Get your estimate'
                ],
                [
                    'translation_id'    => 9,
                    'entry_id'          => 9,
                    'language_id'       => 'en',
                    'title'             => 'Discovery & Exploration',
                    'content'           => 'Capability Detail: D&E',
                    'meta_title'        => 'Discovery & Exploration',
                    'meta_description'  => 'Diving into your business, audience and goals'
                ],
                [
                    'translation_id'    => 10,
                    'entry_id'          => 10,
                    'language_id'       => 'en',
                    'title'             => 'Digital Solutions Strategy',
                    'content'           => 'Capability Detail: DSS',
                    'meta_title'        => 'Digital Solutions Strategy',
                    'meta_description'  => 'Having a vision to help you succeed'
                ],
                [
                    'translation_id'    => 11,
                    'entry_id'          => 11,
                    'language_id'       => 'en',
                    'title'             => 'Prototyping & Design',
                    'content'           => 'Capability Detail: P&D',
                    'meta_title'        => 'Prototyping & Design',
                    'meta_description'  => 'Making the right thing the right way'
                ],
                [
                    'translation_id'    => 12,
                    'entry_id'          => 12,
                    'language_id'       => 'en',
                    'title'             => 'Digital Development',
                    'content'           => 'Capability Detail: DD',
                    'meta_title'        => 'Digital Development',
                    'meta_description'  => 'Building every technical detail'
                ],
                [
                    'translation_id'    => 13,
                    'entry_id'          => 13,
                    'language_id'       => 'en',
                    'title'             => 'Digital Branding',
                    'content'           => 'Capability Detail: DB',
                    'meta_title'        => 'Digital Branding',
                    'meta_description'  => 'Shaping the way you show up'
                ],
                [
                    'translation_id'    => 14,
                    'entry_id'          => 14,
                    'language_id'       => 'en',
                    'title'             => 'Digital Marketing',
                    'content'           => 'Capability Detail: DM',
                    'meta_title'        => 'Digital Marketing',
                    'meta_description'  => 'Standing out, building trust and finding love'
                ],
            ]
        );

        DB::table($this->websiteTable)->insert(
            [
                [
                    'website_object_id' => 101,
                    'parent_id'         => null,
                    'object_id'         => 1,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'home',
                    'uri'               => '/',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 1,
                    'created_at'        => $now
                ],

                // Capabilities and Detail
                [
                    'website_object_id' => 102,
                    'parent_id'         => null,
                    'object_id'         => 2,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'capabilities',
                    'uri'               => '/capabilities',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 2,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 109,
                    'parent_id'         => 102,
                    'object_id'         => 9,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'discovery-exploration',
                    'uri'               => '/capabilities/discovery-exploration',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 3,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 110,
                    'parent_id'         => 102,
                    'object_id'         => 10,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'digital-solutions-strategy',
                    'uri'               => '/capabilities/digital-solutions-strategy',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 4,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 111,
                    'parent_id'         => 102,
                    'object_id'         => 11,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'prototyping-design',
                    'uri'               => '/capabilities/prototyping-design',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 5,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 112,
                    'parent_id'         => 102,
                    'object_id'         => 12,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'digital-development',
                    'uri'               => '/capabilities/digital-development',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 6,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 113,
                    'parent_id'         => 102,
                    'object_id'         => 13,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'digital-branding',
                    'uri'               => '/capabilities/digital-branding',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 7,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 114,
                    'parent_id'         => 102,
                    'object_id'         => 14,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'digital-marketing',
                    'uri'               => '/capabilities/digital-marketing',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 8,
                    'created_at'        => $now
                ],

                [
                    'website_object_id' => 103,
                    'parent_id'         => null,
                    'object_id'         => 3,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'work',
                    'uri'               => '/work',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 9,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 104,
                    'parent_id'         => null,
                    'object_id'         => 4,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'team',
                    'uri'               => '/team',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 10,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 105,
                    'parent_id'         => null,
                    'object_id'         => 5,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'careers',
                    'uri'               => '/careers',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 11,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 106,
                    'parent_id'         => null,
                    'object_id'         => 6,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'blog',
                    'uri'               => '/blog',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 12,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 107,
                    'parent_id'         => null,
                    'object_id'         => 7,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'contacts',
                    'uri'               => '/contacts',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 13,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 108,
                    'parent_id'         => null,
                    'object_id'         => 8,
                    'object_type'       => Entry::class,
                    'content_type'      => 'page',
                    'slug'              => 'estimate',
                    'uri'               => '/estimate',
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 14,
                    'created_at'        => $now
                ],
            ]
        );

        DB::table($this->websiteLangTable)->insert(
            [
                [
                    'wo_translation_id' => 101,
                    'website_object_id' => 101,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'home',
                    'lang_uri'          => '/',
                ],
                [
                    'wo_translation_id' => 102,
                    'website_object_id' => 102,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'capabilities',
                    'lang_uri'          => '/capabilities',
                ],
                [
                    'wo_translation_id' => 103,
                    'website_object_id' => 103,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'work',
                    'lang_uri'          => '/work',
                ],
                [
                    'wo_translation_id' => 104,
                    'website_object_id' => 104,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'team',
                    'lang_uri'          => '/team',
                ],
                [
                    'wo_translation_id' => 105,
                    'website_object_id' => 105,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'careers',
                    'lang_uri'          => '/careers',
                ],
                [
                    'wo_translation_id' => 106,
                    'website_object_id' => 106,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'blog',
                    'lang_uri'          => '/blog',
                ],
                [
                    'wo_translation_id' => 107,
                    'website_object_id' => 107,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'contacts',
                    'lang_uri'          => '/contacts',
                ],
                [
                    'wo_translation_id' => 108,
                    'website_object_id' => 108,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'estimate',
                    'lang_uri'          => '/estimate',
                ],
                [
                    'wo_translation_id' => 109,
                    'website_object_id' => 109,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'discovery-exploration',
                    'lang_uri'          => '/capabilities/discovery-exploration',
                ],
                [
                    'wo_translation_id' => 110,
                    'website_object_id' => 110,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'digital-solutions-strategy',
                    'lang_uri'          => '/capabilities/digital-solutions-strategy',
                ],
                [
                    'wo_translation_id' => 111,
                    'website_object_id' => 111,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'prototyping-design',
                    'lang_uri'          => '/capabilities/prototyping-design',
                ],
                [
                    'wo_translation_id' => 112,
                    'website_object_id' => 112,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'digital-development',
                    'lang_uri'          => '/capabilities/digital-development',
                ],
                [
                    'wo_translation_id' => 113,
                    'website_object_id' => 113,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'digital-branding',
                    'lang_uri'          => '/capabilities/digital-branding',
                ],
                [
                    'wo_translation_id' => 114,
                    'website_object_id' => 114,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'digital-marketing',
                    'lang_uri'          => '/capabilities/digital-marketing',
                ]
            ]
        );
    }
}
