<?php

namespace Database\Seeders;

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

class ClientLogosTableSeeder extends Seeder
{
    private $table = 'client_logos';
    private $langTable = 'client_logo_languages';

    private $mediaTable = 'media_items';

    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->mediaTable)->insert(
            [
                [
                    'id'                => 2,
                    'backend_user_id'   => 1,
                    'filename'          => 'br-logo-test.png',
                    'original_filename' => 'br-logo-test.png',
                    'extension'         => 'png',
                    'related_type'      => null,
                    'media_type'        => 'image',
                    'title'             => 'Sample for tests',
                    'alt'               => 'Boutique dos Relógios',
                    'author'            => null,
                    'width'             => '327',
                    'height'            => '62',
                    'size'              => '9273',
                    'created_at'        => $now
                ],
                [
                    'id'                => 3,
                    'backend_user_id'   => 1,
                    'filename'          => 'lusa-logo-test.png',
                    'original_filename' => 'lusa-logo-test.png',
                    'extension'         => 'png',
                    'related_type'      => null,
                    'media_type'        => 'image',
                    'title'             => 'Sample for tests',
                    'alt'               => 'Lusa',
                    'author'            => null,
                    'width'             => '169',
                    'height'            => '59',
                    'size'              => '3541',
                    'created_at'        => $now
                ],
                [
                    'id'                => 4,
                    'backend_user_id'   => 1,
                    'filename'          => 'trib-logo-test.png',
                    'original_filename' => 'trib-logo-test.png',
                    'extension'         => 'png',
                    'related_type'      => null,
                    'media_type'        => 'image',
                    'title'             => 'Sample for tests',
                    'alt'               => 'Tribanco',
                    'author'            => null,
                    'width'             => '192',
                    'height'            => '62',
                    'size'              => '6258',
                    'created_at'        => $now
                ]
            ]
        );

        DB::table($this->table)->insert(
            [
                [
                    'id'                => 1,
                    'backend_user_id'   => 1,
                    'column_index'      => 1,
                    'logo_image_id'     => 2,
                    'created_at'        => $now
                ],
                [
                    'id'                => 2,
                    'backend_user_id'   => 1,
                    'column_index'      => 2,
                    'logo_image_id'     => 3,
                    'created_at'        => $now
                ],
                [
                    'id'                => 3,
                    'backend_user_id'   => 1,
                    'column_index'      => 3,
                    'logo_image_id'     => 4,
                    'created_at'        => $now
                ],
                [
                    'id'                => 4,
                    'backend_user_id'   => 1,
                    'column_index'      => 1,
                    'logo_image_id'     => 3,
                    'created_at'        => $now
                ],
                [
                    'id'                => 5,
                    'backend_user_id'   => 1,
                    'column_index'      => 2,
                    'logo_image_id'     => 4,
                    'created_at'        => $now
                ],
                [
                    'id'                => 6,
                    'backend_user_id'   => 1,
                    'column_index'      => 3,
                    'logo_image_id'     => 2,
                    'created_at'        => $now
                ]
            ]
        );

        DB::table($this->langTable)->insert(
            [
                [
                    'translation_id'    => 1,
                    'client_logo_id'    => 1,
                    'language_id'       => 'en',
                    'title'             => 'Boutique Relógios col1',
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 2,
                    'client_logo_id'    => 2,
                    'language_id'       => 'en',
                    'title'             => 'Lusa col2',
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 3,
                    'client_logo_id'    => 3,
                    'language_id'       => 'en',
                    'title'             => 'Tribanco col3',
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 4,
                    'client_logo_id'    => 4,
                    'language_id'       => 'en',
                    'title'             => 'Lusa col1',
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 5,
                    'client_logo_id'    => 5,
                    'language_id'       => 'en',
                    'title'             => 'Tribanco col2',
                    'created_at'        => $now
                ],
                [
                    'translation_id'    => 6,
                    'client_logo_id'    => 6,
                    'language_id'       => 'en',
                    'title'             => 'Boutique Relógios col3',
                    'created_at'        => $now
                ]
            ]
        );

        DB::table($this->websiteTable)->insert(
            [
                [
                    'website_object_id' => 401,
                    'parent_id'         => null,
                    'object_id'         => 1,
                    'object_type'       => ClientLogo::class,
                    'content_type'      => 'clientLogo',
                    'slug'              => 'boutique-relogios1',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 1,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 402,
                    'parent_id'         => null,
                    'object_id'         => 2,
                    'object_type'       => ClientLogo::class,
                    'content_type'      => 'clientLogo',
                    'slug'              => 'lusa1',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 2,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 403,
                    'parent_id'         => null,
                    'object_id'         => 3,
                    'object_type'       => ClientLogo::class,
                    'content_type'      => 'clientLogo',
                    'slug'              => 'tribanco1',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 3,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 404,
                    'parent_id'         => null,
                    'object_id'         => 4,
                    'object_type'       => ClientLogo::class,
                    'content_type'      => 'clientLogo',
                    'slug'              => 'lusa2',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 4,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 405,
                    'parent_id'         => null,
                    'object_id'         => 5,
                    'object_type'       => ClientLogo::class,
                    'content_type'      => 'clientLogo',
                    'slug'              => 'tribanco2',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 5,
                    'created_at'        => $now
                ],
                [
                    'website_object_id' => 406,
                    'parent_id'         => null,
                    'object_id'         => 6,
                    'object_type'       => ClientLogo::class,
                    'content_type'      => 'clientLogo',
                    'slug'              => 'boutique-relogios2',
                    'uri'               => null,
                    'template'          => null,
                    'status'            => 'published',
                    'position'          => 6,
                    'created_at'        => $now
                ]
            ]
        );

        DB::table($this->websiteLangTable)->insert(
            [
                [
                    'wo_translation_id' => 401,
                    'website_object_id' => 401,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'boutique-relogios1',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 402,
                    'website_object_id' => 402,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'lusa1',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 403,
                    'website_object_id' => 403,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'tribanco1',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 404,
                    'website_object_id' => 404,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'lusa2',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 405,
                    'website_object_id' => 405,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'tribanco2',
                    'lang_uri'          => null,
                ],
                [
                    'wo_translation_id' => 406,
                    'website_object_id' => 406,
                    'wo_language_id'    => 'en',
                    'lang_slug'         => 'boutique-relogios2',
                    'lang_uri'          => null,
                ]
            ]
        );
    }
}
