<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\BookingCategory;
use App\Models\PrintType;
use App\Models\Lamination;
use App\Models\LaminationSide;
use App\Models\PaperSize;
use App\Models\PaperGsm;
use Illuminate\Support\Facades\DB;

class ClassicCardsDataSeeder extends Seeder
{
    public function run()
    {
        // Disable foreign key checks for truncation if needed
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');

        // 1. Categories
        BookingCategory::truncate();
        $categories = [
            'Invitations', 'Invitation Covers', 'Office Covers', 'Brouchre',
            'Catalogues', 'Letter Head', 'Sticker', 'Calendars', 'Bill Book'
        ];
        foreach ($categories as $i => $name) {
            BookingCategory::create([
                'name' => $name,
                'status' => 1,
                'sort_order' => $i + 1,
                'price' => 0,
            ]);
        }

        // 2. Print Types
        PrintType::truncate();
        $printTypes = ['SINGLE', 'DOUBLE'];
        foreach ($printTypes as $i => $name) {
            PrintType::create(['name' => $name, 'status' => 1, 'sort_order' => $i + 1]);
        }

        // 3. Laminations
        Lamination::truncate();
        $laminations = [
            'GLOSS LAMINATION', 'MATT LAMINATION', '3D LAMINATION', 'UV DRIPPOFF', 'NURLING'
        ];
        foreach ($laminations as $i => $name) {
            Lamination::create(['name' => $name, 'status' => 1, 'sort_order' => $i + 1]);
        }

        // 4. Lamination Sides
        LaminationSide::truncate();
        $laminationSides = ['SINGLE SIDE', 'DOUBLE SIDE'];
        foreach ($laminationSides as $i => $name) {
            LaminationSide::create(['name' => $name, 'status' => 1, 'sort_order' => $i + 1]);
        }

        // 5. Paper Sizes
        PaperSize::truncate();
        $sizes = [
            'A4', 'A3', '22.5" X 11.5"', 'DEMI', 'A4 - ROYAL', 'A3 - ROYAL', 'DEMI ROYAL',
            '24.5" X 11.5"', '20" X 30"', '14.5"X19.5" / 29"X9"', '19"X7" / 14"X9.5"',
            '35"x11" (or) 22"x17.5"', 'Cover A4', 'Cover 10.5" x 4.5"', 'Cover 9" x 4"',
            'Cover 6" x 4"', '28" X 40"', '22" X 28"', '21.5" X 13.5"', 'A4 Bond (210 X 280)',
            'A4 Bond Royal (210 X 297)', 'Sticker - Demi Royal', 'Sticker - A4', 'Sticker - A3',
            'Sticker - Demi', 'Sticker - 15" x 20"', 'Sticker - 20" x 30"'
        ];
        foreach ($sizes as $i => $name) {
            PaperSize::create(['name' => $name, 'status' => 1, 'sort_order' => $i + 1]);
        }

        // 6. GSMs
        PaperGsm::truncate();
        $gsms = [
            '60 Gsm Maplitho', '70 Gsm Maplitho', '80 Gsm Maplitho', '90 Gsm Maplitho', '120 Gsm Maplitho',
            '100 Gsm Art Paper', '105 Gsm Art Paper', '130 Gsm Art Paper', '170 Gsm Art Paper',
            '220 Gsm Art Board', '250 Gsm Art Board', '300 Gsm Art Board', '350 Gsm Art Board',
            '80 Gsm Bond Paper', '100 Gsm Bond Paper', 'Sticker Chrome Art (20" X 30" / 23" X 36")',
            'Sticker Mirror Coat (23" X 36")'
        ];
        foreach ($gsms as $i => $name) {
            PaperGsm::create(['name' => $name, 'status' => 1, 'sort_order' => $i + 1]);
        }
        
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');
    }
}
