<?php

declare(strict_types=1);

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('offer_service_catalog_items', function (Blueprint $table): void {
            $table->id();
            $table->string('name');
            $table->text('default_description')->nullable();
            $table->string('default_pricing_type', 24)->default('one_time');
            $table->string('default_custom_unit_label', 80)->nullable();
            $table->decimal('default_unit_price', 15, 4)->default(0);
            $table->decimal('default_quantity', 15, 4)->default(1);
            $table->decimal('default_vat_rate', 8, 4)->default(0);
            $table->boolean('is_active')->default(true);
            $table->timestamps();
            $table->index(['is_active', 'name']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('offer_service_catalog_items');
    }
};
