<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('cooperative_resolutions', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('hashkey', 300)->unique();
            $table->bigInteger('organization_id')->index();
            $table->string('title');
            $table->text('description')->nullable();
            $table->date('date_approved')->nullable();
            $table->string('document_url')->nullable();
            $table->enum('status', ['PROPOSED', 'APPROVED', 'RESCINDED'])->default('PROPOSED');
            $table->bigInteger('created_by')->nullable();
            $table->bigInteger('updated_by')->nullable();
            $table->boolean('is_active')->default(true);
            $table->datetimes();
        });
    }

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