<?php

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('gatepasses', function (Blueprint $table) {
			$table->id();
			$table->string('gp_number')->unique();
			$table->foreignId('vendor_id')->constrained('contacts')->restrictOnDelete();
			$table->date('date');
			$table->enum('type', ['inbound','outbound'])->default('inbound')->index();
			$table->text('remarks')->nullable();
			$table->timestamps();
			$table->index(['gp_number']);
		});
	}

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