<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('subscription_renewals', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('subscription_id')->index();
            $table->string('particulars');
            $table->unsignedBigInteger('company_id')->index();
            $table->unsignedBigInteger('dealership_id')->index()->nullable();
            $table->enum('transaction_type' ,['new','renew']);
            $table->enum('subscription_type',['monthly','quarterly','annual']);
            $table->unsignedSmallInteger('subscription_terms')->default(1);
            $table->string('supplier')->nullable();
            $table->date('transaction_date')->index();
            $table->date('subscription_start')->index();
            $table->date('expiration')->index();
            $table->text('remarks')->nullable();
            $table->string('created_by');
            $table->timestamps();
            $table->softDeletes();
        });
    }

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