<?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('job_posts', function (Blueprint $table) {
            $table->id();
            $table->foreignId('employer_id')->constrained('users')->onDelete('cascade');
            $table->string('title');
            $table->foreignId('category_id')->constrained('worker_categories');
            $table->integer('workers_needed')->default(1);
            $table->string('job_type'); // Full Time, Part Time, Contract
            $table->string('location');
            $table->decimal('salary', 10, 2);
            $table->date('start_date');
            $table->text('description');
            $table->text('requirements')->nullable();
            $table->string('status')->default('active'); // active, pending, closed
            $table->timestamps();
            $table->softDeletes();
        });
    }

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