<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up()
    {
        Schema::create('kupons', function (Blueprint $table) {
            $table->id();
            $table->string('kode_kupon')->unique();
            $table->enum('jenis_potongan', ['nominal', 'persen']);
            $table->decimal('nominal_potongan', 15, 2);
            $table->decimal('minimal_belanja', 15, 2)->default(0);
            $table->integer('stok_kupon')->default(0);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('kupons');
    }
};
