<?php

namespace Database\Seeders;

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

class PhrasesTableSeeder extends Seeder
{
    private $table = 'phrases';
    private $langTable = 'phrase_languages';

    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,
                    'backend_user_id'           => 1,
                    'is_content_type_specific'  => true,
                    'is_loader_title'           => false,
                    'created_at'                => $now
                ],
                [
                    'id'                        => 2,
                    'backend_user_id'           => 1,
                    'is_content_type_specific'  => true,
                    'is_loader_title'           => false,
                    'created_at'                => $now
                ],
                [
                    'id'                        => 3,
                    'backend_user_id'           => 1,
                    'is_content_type_specific'  => true,
                    'is_loader_title'           => false,
                    'created_at'                => $now
                ],
                [
                    'id'                        => 4,
                    'backend_user_id'           => 1,
                    'is_content_type_specific'  => false,
                    'is_loader_title'           => false,
                    'created_at'                => $now
                ],
                [
                    'id'                        => 5,
                    'backend_user_id'           => 1,
                    'is_content_type_specific'  => false,
                    'is_loader_title'           => false,
                    'created_at'                => $now
                ],
                [
                    'id'                        => 6,
                    'backend_user_id'           => 1,
                    'is_content_type_specific'  => false,
                    'is_loader_title'           => true,
                    'created_at'                => $now
                ],
                [
                    'id'                        => 7,
                    'backend_user_id'           => 1,
                    'is_content_type_specific'  => false,
                    'is_loader_title'           => false,
                    'created_at'                => $now
                ],
                [
                    'id'                        => 8,
                    'backend_user_id'           => 1,
                    'is_content_type_specific'  => false,
                    'is_loader_title'           => false,
                    'created_at'                => $now
                ]
            ]
        );

        DB::table($this->langTable)->insert(
            [
                [
                    'translation_id'    => 1,
                    'phrase_id'         => 1,
                    'language_id'       => 'en',
                    'title'             => 'Team: uniqueness',
                    'phrase'            => "That's why we encourage uniqueness.",
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 2,
                    'phrase_id'         => 2,
                    'language_id'       => 'en',
                    'title'             => 'Team: interesting',
                    'phrase'            => "Uniqueness makes you interesting.",
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 3,
                    'phrase_id'         => 3,
                    'language_id'       => 'en',
                    'title'             => 'Team: valuable',
                    'phrase'            => "What makes you interesting makes you valuable.",
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 4,
                    'phrase_id'         => 4,
                    'language_id'       => 'en',
                    'title'             => 'Transition: Right thing',
                    'phrase'            => '<p>Making the right thing <strong>the right way.</strong></p>',
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 5,
                    'phrase_id'         => 5,
                    'language_id'       => 'en',
                    'title'             => 'Transition: Thinking things',
                    'phrase'            => '<p>Thinking things straight is <strong>doing half the work.</strong></p>',
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 6,
                    'phrase_id'         => 6,
                    'language_id'       => 'en',
                    'title'             => 'Transition: Solid standards',
                    'phrase'            => '<p>Solid standards before <strong>short-lived trends.</strong></p>',
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 7,
                    'phrase_id'         => 7,
                    'language_id'       => 'en',
                    'title'             => 'Transition: Long-term relationships',
                    'phrase'            => '<p>Long-term relationships <strong>over quick-wins.</strong></p>',
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 8,
                    'phrase_id'         => 8,
                    'language_id'       => 'en',
                    'title'             => 'Transition: Client recommendations',
                    'phrase'            => '<p>Most of our Work comes from <strong>client recommendations.</strong></p>',
                    'created_at'        => $now
                ]
            ]
        );

        DB::table($this->websiteTable)->insert(
            [
                [
                    'website_object_id' => 1101,
                    'parent_id'         => null,
                    'object_id'         => 1,
                    'object_type'       => Phrase::class,
                    'content_type'      => 'phrase',
                    'slug'              => 'team-uniqueness',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 1,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 1102,
                    'parent_id'         => null,
                    'object_id'         => 2,
                    'object_type'       => Phrase::class,
                    'content_type'      => 'phrase',
                    'slug'              => 'team-interesting',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 2,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 1103,
                    'parent_id'         => null,
                    'object_id'         => 3,
                    'object_type'       => Phrase::class,
                    'content_type'      => 'phrase',
                    'slug'              => 'team-valuable',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 3,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 1104,
                    'parent_id'         => null,
                    'object_id'         => 4,
                    'object_type'       => Phrase::class,
                    'content_type'      => 'phrase',
                    'slug'              => 'transition-right-thing',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 4,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 1105,
                    'parent_id'         => null,
                    'object_id'         => 5,
                    'object_type'       => Phrase::class,
                    'content_type'      => 'phrase',
                    'slug'              => 'transition-thinking-things',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 5,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 1106,
                    'parent_id'         => null,
                    'object_id'         => 6,
                    'object_type'       => Phrase::class,
                    'content_type'      => 'phrase',
                    'slug'              => 'transition-solid-standards',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 6,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 1107,
                    'parent_id'         => null,
                    'object_id'         => 7,
                    'object_type'       => Phrase::class,
                    'content_type'      => 'phrase',
                    'slug'              => 'transition-long-term-relationships',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 7,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 1108,
                    'parent_id'         => null,
                    'object_id'         => 8,
                    'object_type'       => Phrase::class,
                    'content_type'      => 'phrase',
                    'slug'              => 'transition-client-recommendations',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 8,
                    'created_at'        => $now
                ]
            ]
        );

        DB::table($this->websiteLangTable)->insert(
            [
                [
                    'wo_translation_id' => 1101,
                    'website_object_id' => 1101,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'team-uniqueness',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 1102,
                    'website_object_id' => 1102,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'team-interesting',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 1103,
                    'website_object_id' => 1103,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'team-valuable',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 1104,
                    'website_object_id' => 1104,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'transition-right-thing',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 1105,
                    'website_object_id' => 1105,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'transition-thinking-things',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 1106,
                    'website_object_id' => 1106,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'transition-solid-standards',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 1107,
                    'website_object_id' => 1107,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'transition-long-term-relationships',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 1108,
                    'website_object_id' => 1108,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'transition-client-recommendations',
                    'lang_uri'          => null,
                ]
            ]
        );
    }
}
