<?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('menu_group_menus', function (Blueprint $table) {

            $table->id();

            $table->foreignId('menu_group_id')
                ->constrained()
                ->cascadeOnDelete();

            $table->foreignId('menu_id')
                ->constrained('menu_lists')
                ->cascadeOnDelete();

            $table->boolean('can_view')->default(false);

            $table->boolean('can_create')->default(false);

            $table->boolean('can_update')->default(false);

            $table->boolean('can_delete')->default(false);

            $table->boolean('can_approve')->default(false);

            $table->boolean('can_export')->default(false);

            $table->timestamps();

            $table->unique([
                'menu_group_id',
                'menu_id'
            ]);
        });
    }

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