<?php
// database/migrations/[timestamp]_create_activity_logs_table.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('activity_logs', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->onDelete('cascade');
            $table->time('start_time')->nullable();
            $table->time('end_time')->nullable();
            $table->integer('duration_minutes')->nullable();
            $table->enum('mood', ['Bagus', 'Lumayan', 'Biasa Saja', 'Cukup Jenuh', 'Jenuh']);
            $table->enum('sleep_duration', ['<4', '4-7', '>7']);
            $table->date('activity_date');
            $table->timestamps();
            
            $table->unique(['user_id', 'activity_date']);
        });
    }

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