<?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('finalise_percentage_adjustments', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id');
            $table->unsignedBigInteger('trading_year_id');
            $table->integer('private_use_adj_car');
            $table->enum('override_mileage', ['Yes', 'No']);
            $table->integer('private_use_adj_phone');
            $table->string('got_another_job');
            $table->integer('radio_rent_cash');
            $table->integer('radio_rent_card_bank');
            $table->integer('radio_rent_acc_contract');
            $table->integer('radio_rent_sub_contract');
            $table->timestamps();

            // Foreign key relationships
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->foreign('trading_year_id')->references('id')->on('trading_years')->onDelete('cascade');
        });
    }

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