<?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('dynamics',function (Blueprint $table) {
			$table->id();
			$table->timestamps();
			$table->string('name')->unqiue();
			$table->enum('frequency',['ONCE','DAILY','WEEKLY','MONTHLY'])->unsigned();
			$table->date('start_date');
			$table->time('start_time');
			$table->datetime('next_at');
			$table->string('model');
			$table->json('arguments')->nullable();
			$table->boolean('active')->nullable();

			$table->bigInteger('address_id');
			$table->foreign('address_id')->references('id')->on('addresses');

			$table->softDeletes();
		});
    }

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