<?php

namespace Database\Seeders;

use App\Models\Product;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class ProductSeeder extends Seeder
{
    public function run()
    {
        Product::create([
            'name' => [
                'uz' => 'Kofe',
                'ru' => 'Кофе'
            ],
            'body' => [
                'uz' => 'Kofe body',
                'ru' => 'Кофе body'
            ],
            'short_body' => [
                'uz' => 'Kofe short body',
                'ru' => 'Кофе short body'
            ],
            'price' => 10000,
            'price_discount' => 9000,
            'brand_id' => 1,
            'poster' => 'products/1.jpg',
            'poster_thumb' => 'products/1_thumb.jpg',
            'color_id' => 1,
            'count' => 100,
            'published' => true,
            'leader_of_sales' => true,
        ]);
        DB::insert('insert into categories_products (product_id, category_id) values (?, ?)', [1, 1]);

        Product::create([
            'name' => [
                'uz' => 'Chay',
                'ru' => 'Чай'
            ],
            'body' => [
                'uz' => 'Chay body',
                'ru' => 'Чай body'
            ],
            'short_body' => [
                'uz' => 'Chay short body',
                'ru' => 'Чай short body'
            ],
            'price' => 5000,
            'price_discount' => 4500,
            'brand_id' => 1,
            'poster' => 'products/2.jpg',
            'poster_thumb' => 'products/2_thumb.jpg',
            'color_id' => 2,
            'count' => 200,
            'published' => true,
            'leader_of_sales' => true,
        ]);
        DB::insert('insert into categories_products (product_id, category_id) values (?, ?)', [2, 1]);

        for ($i = 1; $i < 20; $i++) {
            Product::create([
                'name' => [
                    'uz' => 'Shokolad',
                    'ru' => 'Шоколад'
                ],
                'body' => [
                    'uz' => 'Shokolad body',
                    'ru' => 'Шоколад body'
                ],
                'short_body' => [
                    'uz' => 'Shokolad short body',
                    'ru' => 'Шоколад short body'
                ],
                'price' => 15000,
                'price_discount' => 13500,
                'brand_id' => 2,
                'poster' => 'products/3.jpg',
                'poster_thumb' => 'products/3_thumb.jpg',
                'color_id' => 2,
                'count' => 300,
                'published' => true,
                'leader_of_sales' => true,
            ]);
        }

        DB::insert('insert into categories_products (product_id, category_id) values (?, ?)', [3, 2]);
    }
}
