<?php

namespace Database\Seeders;

use App\Models\Inquiry;
use App\Models\Product;
use Illuminate\Database\Seeder;

class InquirySeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $products = Product::inRandomOrder()->take(15)->get();
        
        $inquiries = [
            [
                'name' => 'Sarah Johnson',
                'email' => 'sarah.johnson@email.com',
                'message' => 'Hi! I\'m interested in ordering a custom birthday cake for my daughter\'s 8th birthday party. Do you offer custom designs? What\'s the lead time?',
                'status' => 'pending',
            ],
            [
                'name' => 'Michael Chen',
                'email' => 'mchen@email.com',
                'message' => 'I love your sourdough bread! Do you offer bulk orders for events? I\'m planning a corporate breakfast next month.',
                'status' => 'resolved',
            ],
            [
                'name' => 'Emily Rodriguez',
                'email' => 'emily.r@email.com',
                'message' => 'Are your gluten-free options made in a dedicated gluten-free facility? I have celiac disease and need to be careful.',
                'status' => 'pending',
            ],
            [
                'name' => 'David Thompson',
                'email' => 'dthompson@email.com',
                'message' => 'Do you deliver? I\'m interested in ordering some pastries for a morning meeting but won\'t be able to pick them up.',
                'status' => 'resolved',
            ],
            [
                'name' => 'Lisa Anderson',
                'email' => 'lisa.a@email.com',
                'message' => 'I tried your chocolate chip cookies last week and they were amazing! Can I place a standing order for every Friday?',
                'status' => 'pending',
            ],
            [
                'name' => 'Robert Williams',
                'email' => 'rwilliams@email.com',
                'message' => 'Do you have any vegan options for cakes? I\'m looking for something special for my anniversary dinner.',
                'status' => 'resolved',
            ],
            [
                'name' => 'Jennifer Martinez',
                'email' => 'j.martinez@email.com',
                'message' => 'I\'m interested in your seasonal pumpkin spice cake. When will it be available? Can I pre-order?',
                'status' => 'pending',
            ],
            [
                'name' => 'James Wilson',
                'email' => 'jwilson@email.com',
                'message' => 'Your croissants are the best I\'ve had outside of France! Do you offer baking classes? I\'d love to learn your technique.',
                'status' => 'pending',
            ],
            [
                'name' => 'Amanda Davis',
                'email' => 'amanda.d@email.com',
                'message' => 'I need a large order of donuts for a school event. About 50 pieces. What flavors do you recommend?',
                'status' => 'resolved',
            ],
            [
                'name' => 'Christopher Brown',
                'email' => 'cbrown@email.com',
                'message' => 'Do you make wedding cakes? I\'m getting married in 3 months and would love to discuss options.',
                'status' => 'pending',
            ],
            [
                'name' => 'Jessica Taylor',
                'email' => 'j.taylor@email.com',
                'message' => 'I\'m planning a brunch party and would love to order some of your quiches. How many do you recommend for 20 people?',
                'status' => 'pending',
            ],
            [
                'name' => 'Daniel Garcia',
                'email' => 'dgarcia@email.com',
                'message' => 'Are your products available for wholesale? I run a small café and would love to feature your pastries.',
                'status' => 'pending',
            ],
            [
                'name' => 'Michelle Lee',
                'email' => 'mlee@email.com',
                'message' => 'I have a nut allergy. Which of your products are safe for me? Do you have a list of allergens?',
                'status' => 'resolved',
            ],
            [
                'name' => 'Kevin White',
                'email' => 'kwhite@email.com',
                'message' => 'Your apple pie is incredible! Do you use local apples? I\'m interested in seasonal ingredients.',
                'status' => 'pending',
            ],
            [
                'name' => 'Nicole Harris',
                'email' => 'nharris@email.com',
                'message' => 'I\'m organizing a baby shower and need a beautiful cake. Do you have photos of your previous work I could see?',
                'status' => 'pending',
            ],
        ];

        foreach ($inquiries as $index => $inquiryData) {
            $product = $products->random();
            
            Inquiry::create([
                'name' => $inquiryData['name'],
                'email' => $inquiryData['email'],
                'message' => $inquiryData['message'],
                'product_id' => $product->id,
                'status' => $inquiryData['status'],
                'created_at' => now()->subDays(rand(1, 30)),
            ]);
        }
    }
}

















