<?php

namespace Database\Seeders;

use App\Models\Coupon;
use Illuminate\Database\Seeder;

class CouponSeeder extends Seeder
{
    public function run(): void
    {
        Coupon::query()->updateOrCreate(
            ['code' => 'WELCOME50'],
            [
                'description' => 'Flat Rs 50 off on first order',
                'type' => 'flat',
                'value' => 50,
                'min_order_amount' => 299,
                'usage_limit' => 500,
                'used_count' => 0,
                'is_active' => true,
                'starts_at' => now()->subDay(),
                'expires_at' => now()->addYear(),
            ]
        );
    }
}
