<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class LogKecemasanModel extends Model
{
    protected $table = 'log_hasil_kecemasan';

    protected $primaryKey = 'id_log_kecemasan';

    protected $keyType = 'string';

    public $incrementing = false;

    protected $fillable = [
        'id_log_kecemasan',
        'id_booking',
        'id_test_sessions',
        'start_timestamp',
        'end_timestamp',
        'difference_timestamp',
        'screen_width',
        'screen_height',
        'answered_count',
        'not_answered_count',
        'total_question',
        'skor_kecemasan'
    ];

    protected $casts = [
        'id_log_kecemasan' => 'string',
        'id_booking' => 'string',
        'id_test_sessions' => 'string',
    ];

    public static function boot()
    {
        parent::boot();
        static::creating(function ($model) {
            if (empty($model->id_log_kecemasan)) {
                $model->id_log_kecemasan = (string) \Illuminate\Support\Str::uuid();
            }
        });
    }
}
